Subversion Repositories Projects

Compare Revisions

Ignore whitespace Rev 1701 → Rev 1702

/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSBulb/EOSBulb.pde
0,0 → 1,80
/* Bulb mode demo */
/* Works with cameras which have bulb mode in shutter speed list (in other words, ones that don't have a letter 'B' on mode dial */
/* Tested with EOS Rebel XSI (450D) */
/* Camera has to be switched to manual mode */
 
#include <inttypes.h>
#include <avr/pgmspace.h>
 
//#include <Spi.h>
#include <Max3421e.h>
#include <Max3421e_constants.h>
#include <Max_LCD.h>
#include <Usb.h>
 
#include <ptp.h>
#include <canoneos.h>
 
#define DEV_ADDR 1
 
// Canon EOS 450D
#define DATA_IN_EP 1
#define DATA_OUT_EP 2
#define INTERRUPT_EP 3
#define CONFIG_NUM 1
 
#define SHUTTER_SPEED_BULB 0x0c
 
class CamStateHandlers : public EOSStateHandlers
{
enum CamStates { stInitial, stDisconnected, stConnected };
CamStates stateConnected;
public:
CamStateHandlers() : stateConnected(stInitial)
{
};
virtual void OnDeviceDisconnectedState(PTP *ptp);
virtual void OnDeviceInitializedState(PTP *ptp);
} CamStates;
 
CanonEOS Eos(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);
 
void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
{
if (stateConnected == stConnected || stateConnected == stInitial)
{
stateConnected = stDisconnected;
Notify(PSTR("Camera disconnected\r\n"));
}
}
 
void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
{
if (stateConnected == stDisconnected)
{
stateConnected = stConnected;
uint16_t rc = Eos.SetProperty(EOS_DPC_ShutterSpeed,SHUTTER_SPEED_BULB);
if (rc != PTP_RC_OK)
Message(PSTR("Error: "), rc);
}
 
Eos.StartBulb();
delay(6000);
Eos.StopBulb();
}
 
void setup()
{
Serial.begin( 115200 );
Serial.println("Start");
Eos.Setup();
delay( 200 );
}
 
void loop() {
Eos.Task();
}
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/EOSCamController.pde
0,0 → 1,556
/* Digital camera controller board test sketch */
//#include <Spi.h>
#include <Max3421e.h>
#include <Usb.h>
#include <Max_LCD.h>
#include <simpletimer.h>
#include <valuelist.h>
#include <canoneos.h>
#include <qep_port.h>
 
#include "camcontroller.h"
#include "controls.h"
#include "eoseventparser.h"
#include "dataitem.h"
#include "screenitem.h"
#include "screen.h"
#include "menu.h"
#include "hdrcapture.h"
 
#define DEV_ADDR 1
 
// Canon EOS 400D
#define DATA_IN_EP 1
#define DATA_OUT_EP 2
#define INTERRUPT_EP 3
#define CONFIG_NUM 1
 
#define EEP_APERTURE_LIST_OFFSET 0
#define EEP_APERTURE_LIST_SIZE 32
 
#define EEP_SHTSPEED_LIST_OFFSET (EEP_APERTURE_LIST_OFFSET + EEP_APERTURE_LIST_SIZE)
#define EEP_SHTSPEED_LIST_SIZE 64
 
#define EEP_WBALANCE_LIST_OFFSET (EEP_SHTSPEED_LIST_OFFSET + EEP_SHTSPEED_LIST_SIZE)
#define EEP_WBALANCE_LIST_SIZE 12
 
#define EEP_PICSTYLE_LIST_OFFSET (EEP_WBALANCE_LIST_OFFSET + EEP_WBALANCE_LIST_SIZE)
#define EEP_PICSTYLE_LIST_SIZE 12
 
#define EEP_EXPOCOR_LIST_OFFSET (EEP_PICSTYLE_LIST_OFFSET + EEP_PICSTYLE_LIST_SIZE)
#define EEP_EXPOCOR_LIST_SIZE 48
 
#define EEP_ISO_LIST_OFFSET (EEP_EXPOCOR_LIST_OFFSET + EEP_EXPOCOR_LIST_SIZE)
#define EEP_ISO_LIST_SIZE 8
 
EEPROMByteList vlAperture(EEP_APERTURE_LIST_OFFSET, EEP_APERTURE_LIST_SIZE);
EEPROMByteList vlShutterSpeed(EEP_SHTSPEED_LIST_OFFSET, EEP_SHTSPEED_LIST_SIZE);
EEPROMByteList vlWhiteBalance(EEP_WBALANCE_LIST_OFFSET, EEP_WBALANCE_LIST_SIZE);
EEPROMByteList vlPictureStyle(EEP_PICSTYLE_LIST_OFFSET, EEP_PICSTYLE_LIST_SIZE);
EEPROMByteList vlIso(EEP_ISO_LIST_OFFSET, EEP_ISO_LIST_SIZE);
EEPROMByteList vlExpCompensation(EEP_EXPOCOR_LIST_OFFSET, EEP_EXPOCOR_LIST_SIZE);
 
class CamStateHandlers : public EOSStateHandlers
{
bool stateConnected;
public:
CamStateHandlers() : stateConnected(false) {};
virtual void OnDeviceDisconnectedState(PTP *ptp);
virtual void OnDeviceInitializedState(PTP *ptp);
};
 
class CamHDRCapture : public HDRCapture
{
public:
CamHDRCapture(CanonEOS &eos) : HDRCapture(eos) {};
protected:
virtual void OnFrameCaptured(uint16_t left);
virtual void OnSelfTimerProgress(uint32_t left);
virtual void OnIntrTimerProgress(uint32_t left);
};
 
CamStateHandlers CamStates;
Max_LCD LCD;
SimpleTimer ControlTimer, PTPPollTimer;
 
CanonEOS Eos(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);
CamHDRCapture hdrCapture(Eos);
GPInRegister ExtControls(Eos.GetMax());
QEvent evtTick, evtAbort;
 
//--- (0) Message Screen ----------------------------------------------------------------------
PgmStringDataItem diFirst(msgCamera);
PgmStringDataItem diSecond(msgDisconnected);
 
ScreenItem siFirst (5, 0, 16, false, &diFirst);
ScreenItem siSecond (2, 1, 16, false, &diSecond);
 
ScreenItem *messageScreenItems[] PROGMEM = { &siFirst, &siSecond };
Screen messageScreen(2, (ScreenItem*)messageScreenItems);
 
//--- (1) Main Menu Screen --------------------------------------------------------------------
ScreenItem siIntervalometer (1, 0, 8, true, (const char*)&msgIntervalometer);
ScreenItem siSettings (1, 1, 8, false, (const char*)&msgSettings);
 
ScreenItem *mainMenuScreenItems[] PROGMEM = { &siIntervalometer, &siSettings };
Screen scrMainMenu(2, (ScreenItem*)mainMenuScreenItems);
 
//--- (2) Timer Menu Screen -------------------------------------------------------------------
ScreenItem siSelf (1, 0, 4, true, (const char*)&msgSetSelf);
ScreenItem siFrames (1, 1, 4, false, (const char*)&msgSetFrames);
ScreenItem siBkt (6, 0, 3, false, (const char*)&msgSetBkt);
ScreenItem siInterval (6, 1, 3, false, (const char*)&msgSetInterval);
ScreenItem siRun (10, 0, 4, false, (const char*)&msgSetRun);
ScreenItem siExit (10, 1, 4, false, (const char*)&msgExit);
 
ScreenItem *timerSettingsScreenItems[] PROGMEM = { &siSelf, &siFrames, &siBkt, &siInterval, &siRun, &siExit };
Screen timerSettingsScreen(6, (ScreenItem*)timerSettingsScreenItems);
 
//--- (3) Self Timer Screen -------------------------------------------------------------------
DIT_TIMER_DIGIT_PAIR diHourSelf(0), diHourInt(0),
diMinSelf(0), diMinInt(0),
diSecSelf(0), diSecInt(0);
 
ScreenItem siSelfTimer(0, 0, 16, false, (const char*)&msgSelfTimer);
ScreenItem siHourSelf(3, 1, 2, false, &diHourSelf);
ScreenItem siMinSelf (6, 1, 2, false, &diMinSelf);
ScreenItem siSecSelf (9, 1, 2, false, &diSecSelf);
 
ScreenItem *scitmSelfTimerSet[] PROGMEM = { &siSelfTimer, &siHourSelf, &siMinSelf, &siSecSelf };
Screen scrSelfTimerSet(4, (ScreenItem*)scitmSelfTimerSet);
 
//--- (4) Number of Frames Screen -------------------------------------------------------------
IntDataItem<uint16_t, 5> diFramesCount(0);
IntDataItem<uint16_t, 5> diFramesLeft(0);
 
ScreenItem siFramesText (5, 0, 6, false, (const char*)&msgCntFrames);
ScreenItem siFramesCount (6, 1, 4, false, &diFramesCount);
 
ScreenItem *scitmFramesSet[] PROGMEM = { &siFramesText, &siFramesCount };
Screen scrFramesSet(2, (ScreenItem*)scitmFramesSet);
 
//--- (5) Bracketing Screen -------------------------------------------------------------------
KeyValuePairDataItem<uint8_t, 37, 7> diBktEV(0, ExpCompTitles);
KeyValuePairDataItem<uint8_t, 37, 7> diBktStep(0, ExpCompTitles);
uint8_t nBktStep;
uint8_t nBktNegativeIndex;
uint8_t nBktPositiveIndex;
 
ScreenItem siBracketing(0, 0, 15, false, (const char*)&msgBracketing);
ScreenItem siBktEV (1, 1, 6, false, &diBktEV);
ScreenItem siBktStep (9, 1, 6, false, &diBktStep);
 
ScreenItem *scitmBkt[] PROGMEM = { &siBracketing, &siBktEV, &siBktStep };
Screen scrBktSet(3, (ScreenItem*)scitmBkt);
 
//--- (6) Interval Timer Screen ---------------------------------------------------------------
ScreenItem siIntTimer(0, 0, 16, false, (const char*)&msgIntTimer);
ScreenItem siHourInt(3, 1, 2, false, &diHourInt);
ScreenItem siMinInt (6, 1, 2, false, &diMinInt);
ScreenItem siSecInt (9, 1, 2, false, &diSecInt);
 
ScreenItem *scitmIntTimerSet[] PROGMEM = { &siIntTimer, &siHourInt, &siMinInt, &siSecInt };
Screen scrIntTimerSet(4, (ScreenItem*)scitmIntTimerSet);
 
//--- (7) Run Screen ---------------------------------------------------------------------------
TimeSpanDataItem diLeftTimer(0);
TimeSpanDataItem diIntTimer(0);
 
ScreenItem siRunLeftTime( 0, 0, 8, false, &diLeftTimer);
ScreenItem siRunIntTime( 0, 1, 8, false, &diIntTimer);
ScreenItem siRunFramesLeft ( 10, 0, 4, false, &diFramesLeft);
ScreenItem siAbort(10, 1, 5, false, (const char*)&msgAbort);
 
ScreenItem *scitmRun[] PROGMEM = { &siRunLeftTime, &siRunIntTime, &siRunFramesLeft, &siAbort };
Screen scrRun(4, (ScreenItem*)scitmRun);
 
//--- (8) Camera Settings Screen ---------------------------------------------------------------
DIT_MODE diMode(0, ModeTitles);
DIT_APERTURE diAperture(0, ApertureTitles);
DIT_WB diWb(0, WbTitles);
DIT_SHUTTER_SPEED diShutterSpeed(0, ShutterSpeedTitles);
DIT_PSTYLE diPStyle(0, PStyleTitles);
DIT_ISO diIso(0, IsoTitles);
DIT_EXPCOMP diExpComp(0, ExpCompTitles);
 
ScreenItem siMode ( 0, 0, 3, false, &diMode);
ScreenItem siAperture ( 0, 1, 3, false, &diAperture);
ScreenItem siWb ( 4, 0, 3, false, &diWb);
ScreenItem siShutterSpeed( 4, 1, 4, false, &diShutterSpeed);
ScreenItem siPStyle ( 8, 0, 3, false, &diPStyle);
ScreenItem siIso (12, 0, 4, false, &diIso);
ScreenItem siExpComp ( 9, 1, 6, false, &diExpComp);
 
ScreenItem *scitmSettings[] PROGMEM = { &siMode, &siAperture, &siWb, &siShutterSpeed, &siPStyle, &siIso, &siExpComp };
Screen scrSettings(7, (ScreenItem*)scitmSettings);
 
IntSpin<DIT_TIMER_DIGIT_PAIR, uint8_t> hourSpinSelf(0, 99, 1, &diHourSelf, NULL);
IntSpin<DIT_TIMER_DIGIT_PAIR, uint8_t> minSpinSelf(0, 99, 1, &diMinSelf, NULL);
IntSpin<DIT_TIMER_DIGIT_PAIR, uint8_t> secSpinSelf(0, 99, 1, &diSecSelf, NULL);
 
IntSpin<DIT_TIMER_DIGIT_PAIR, uint8_t> hourSpinInt(0, 99, 1, &diHourInt, NULL);
IntSpin<DIT_TIMER_DIGIT_PAIR, uint8_t> minSpinInt(0, 99, 1, &diMinInt, NULL);
IntSpin<DIT_TIMER_DIGIT_PAIR, uint8_t> secSpinInt(0, 99, 1, &diSecInt, NULL);
 
 
void SpinSetAperture(DataItemBase *data_item)
{
Eos.SetProperty(EOS_DPC_Aperture, ((DIT_APERTURE*)data_item)->Get());
};
 
void SpinSetShutterSpeed(DataItemBase *data_item)
{
Eos.SetProperty(EOS_DPC_ShutterSpeed, ((DIT_SHUTTER_SPEED*)data_item)->Get());
};
 
void SpinSetWb(DataItemBase *data_item)
{
Eos.SetProperty(EOS_DPC_WhiteBalance, ((DIT_WB*)data_item)->Get());
};
 
void SpinSetPStyle(DataItemBase *data_item)
{
Eos.SetProperty(EOS_DPC_PictureStyle, ((DIT_PSTYLE*)data_item)->Get());
};
 
void SpinSetIso(DataItemBase *data_item)
{
Eos.SetProperty(EOS_DPC_Iso, ((DIT_ISO*)data_item)->Get());
};
 
void SpinSetExpComp(DataItemBase *data_item)
{
Eos.SetProperty(EOS_DPC_ExposureCompensation, ((DIT_EXPCOMP*)data_item)->Get());
};
 
void SpinUpdateBktStepValues(DataItemBase *data_item);
void SpinUpdateBktStep(DataItemBase *data_item);
 
EEPROMListIntSpin<DIT_APERTURE, VT_APERTURE> spinAperture(&vlAperture, &diAperture, &SpinSetAperture);
EEPROMListIntSpin<DIT_SHUTTER_SPEED, VT_SHSPEED> spinShutterSpeed(&vlShutterSpeed, &diShutterSpeed, &SpinSetShutterSpeed);
EEPROMListIntSpin<DIT_WB, VT_WB> spinWb(&vlWhiteBalance, &diWb, &SpinSetWb);
EEPROMListIntSpin<DIT_PSTYLE, VT_PSTYLE> spinPStyle(&vlPictureStyle, &diPStyle, &SpinSetPStyle);
EEPROMListIntSpin<DIT_ISO, VT_ISO> spinIso(&vlIso, &diIso, &SpinSetIso);
 
EEPROMListIntSpin<EXP_COMP_DATA_ITEM, VT_EXPCOMP> spinExpComp(&vlExpCompensation, &diExpComp, &SpinSetExpComp);
EEPROMListIntSpin<EXP_COMP_DATA_ITEM, VT_EXPCOMP> spinBktEV (&vlExpCompensation, &diBktEV, &SpinUpdateBktStepValues);
 
BKT_STEP_VALUE_LIST vlExpCompStep;
 
SRAMListIntSpin<EXP_COMP_DATA_ITEM, VT_EXPCOMP, BKT_STEP_VALUE_LIST> spinBktStep(&vlExpCompStep, &diBktStep, &SpinUpdateBktStep);
 
 
void SpinUpdateBktStepValues(DataItemBase *data_item)
{
uint8_t cur_value = ((EXP_COMP_DATA_ITEM*)data_item)->Get();
vlExpCompStep.SetSize(0);
// Check value for zerro. Exit on zerro.
if (cur_value == 0)
return;
// Calculate negative and positive values of expo compensation
uint8_t negative_value = (cur_value & 0x80) ? cur_value : ~(cur_value - 1);
uint8_t positive_value = (cur_value & 0x80) ? ~(cur_value - 1) : cur_value;
// Get indices of negative and positive expo compensation values
uint16_t negative_index = vlExpCompensation.GetValueIndex(negative_value);
uint16_t positive_index = vlExpCompensation.GetValueIndex(positive_value);
 
nBktNegativeIndex = negative_index;
nBktPositiveIndex = positive_index;
// Calculate interval length
uint16_t len = positive_index - negative_index;
 
// Calculate zerro value index
uint16_t zerro_index = vlExpCompensation.GetValueIndex(0);
 
// Calculate positive index offset
uint16_t zerro_based_offset = positive_index - zerro_index;
// Calculate all possible interval indices
for (uint16_t i = zerro_based_offset, j = positive_index; i>0; i--, j--)
{
// Insert values into the list
if (len % i == 0)
vlExpCompStep.Append(vlExpCompensation.Get(j));
}
diBktStep.Set(cur_value);
diBktStep.SetUpdated(true);
};
 
void SpinUpdateBktStep(DataItemBase *data_item)
{
uint8_t cur_value = ((EXP_COMP_DATA_ITEM*)data_item)->Get();
nBktStep = vlExpCompensation.GetValueIndex(cur_value) - vlExpCompensation.GetValueIndex(0);
};
 
void MenuExit();
void MenuSetAperture();
void MenuSetShutterSpeed();
void MenuSetWb();
void MenuSetPStyle();
void MenuSetIso();
void MenuSetExpComp();
 
extern Menu mainMenu;
 
//--- Camera Settings Menu -----------------------------------------------------------------
MenuItem settingsMenuItems[] = { {&siMode, &MenuExit}, {&siAperture, &MenuSetAperture}, {&siWb, &MenuSetWb}, {&siShutterSpeed, &MenuSetShutterSpeed}, {&siPStyle, &MenuSetPStyle}, {&siIso, &MenuSetIso}, {&siExpComp, &MenuSetExpComp} };
Menu settingsMenu(8, 7, settingsMenuItems, 0, &mainMenu);
 
void MenuSetAperture() { spinAperture.SetReturnState(&settingsMenu); StateMachine::SetState(&spinAperture); };
void MenuSetShutterSpeed() { spinShutterSpeed.SetReturnState(&settingsMenu); StateMachine::SetState(&spinShutterSpeed); };
void MenuSetWb(){ spinWb.SetReturnState(&settingsMenu); StateMachine::SetState(&spinWb); };
void MenuSetPStyle(){ spinPStyle.SetReturnState(&settingsMenu); StateMachine::SetState(&spinPStyle); };
void MenuSetIso(){ spinIso.SetReturnState(&settingsMenu); StateMachine::SetState(&spinIso); };
void MenuSetExpComp(){ spinExpComp.SetReturnState(&mainMenu); StateMachine::SetState(&spinExpComp); };
 
//--- Self Timer Menu ----------------------------------------------------------------------
void MenuSelfSetH();
void MenuSelfSetM();
void MenuSelfSetS();
 
extern Menu timerSettingsMenu;
 
MenuItem selfSetMenuItems[] = { {&siHourSelf, &MenuSelfSetH}, {&siMinSelf, &MenuSelfSetM}, {&siSecSelf, &MenuSelfSetS} };
Menu selfSetMenu(3, 3, selfSetMenuItems, 0, &timerSettingsMenu);
 
void MenuSelfSetH() { hourSpinSelf.SetReturnState(&selfSetMenu); StateMachine::SetState(&hourSpinSelf); };
void MenuSelfSetM() { minSpinSelf.SetReturnState(&selfSetMenu); StateMachine::SetState(&minSpinSelf); };
 
//--- Timer Settings Menu ------------------------------------------------------------------
void MenuSelf();
void MenuBkt();
void MenuFrames();
void MenuInterval();
void MenuExit();
void MenuRun();
 
MenuItem timerSettingsMenuItems[] = { {&siSelf, &MenuSelf}, {&siFrames, &MenuFrames}, {&siBkt, &MenuBkt}, {&siInterval, &MenuInterval}, {&siRun, &MenuRun}, {&siExit, &MenuExit} };
Menu timerSettingsMenu(2, 6, timerSettingsMenuItems, 0, &mainMenu);
 
void MenuSelfSetS() { secSpinSelf.SetReturnState(&timerSettingsMenu); StateMachine::SetState(&secSpinSelf); };
 
void MenuSelf() { StateMachine::SetState(&selfSetMenu); };
 
void MenuBktSetStep();
void MenuBktStepExit();
 
MenuItem bktSetMenuItems[] = { {&siBktEV, &MenuBktSetStep}, {&siBktStep, &MenuBktStepExit} };
Menu bktSetMenu(5, 2, bktSetMenuItems, 0, &timerSettingsMenu);
 
void MenuBktSetStep()
{
spinBktEV.SetReturnState(&bktSetMenu);
 
if (vlExpCompensation.GetSize())
StateMachine::SetState(&spinBktEV);
};
 
void MenuBktStepExit()
{
spinBktStep.SetReturnState(&timerSettingsMenu);
 
if (vlExpCompensation.GetSize())
StateMachine::SetState(&spinBktStep);
};
 
void MenuBkt()
{
if (vlExpCompensation.GetSize())
StateMachine::SetState(&bktSetMenu);
};
 
 
IntSpin<IntDataItem<uint16_t, 5>, int16_t> framesSpin(0, 9999, 1, &diFramesCount, NULL);
 
void MenuFrames() { framesSpin.SetReturnState(&timerSettingsMenu); Screen::Set(4); StateMachine::SetState(&framesSpin); };
 
void MenuIntSetH();
void MenuIntSetM();
void MenuIntSetS();
 
MenuItem intSetMenuItems[] = { {&siHourInt, &MenuIntSetH}, {&siMinInt, &MenuIntSetM}, {&siSecInt, &MenuIntSetS} };
Menu intSetMenu(6, 3, intSetMenuItems, 0, &timerSettingsMenu);
 
void MenuIntSetH() { hourSpinInt.SetReturnState(&intSetMenu); StateMachine::SetState(&hourSpinInt); };
void MenuIntSetM() { minSpinInt.SetReturnState(&intSetMenu); StateMachine::SetState(&minSpinInt); };
void MenuIntSetS() { secSpinInt.SetReturnState(&timerSettingsMenu); StateMachine::SetState(&secSpinInt); };
 
void MenuInterval() { StateMachine::SetState(&intSetMenu); };
 
void MenuRunAbort()
{
hdrCapture.PostEvent(&evtAbort);
diFramesLeft.Set(0);
StateMachine::SetState(&timerSettingsMenu);
};
 
MenuItem runMenuItems[] = { {&siAbort, &MenuRunAbort} };
Menu runMenu(7, 1, runMenuItems, 0);
 
void MenuRun()
{
if (!diFramesCount.Get())
return;
uint32_t intr_timeout = ((uint32_t)diHourInt.Get() * 3600 + (uint32_t)diMinInt.Get() * 60 + (uint32_t)diSecInt.Get());
uint32_t self_timeout = ((uint32_t)diHourSelf.Get() * 3600 + (uint32_t)diMinSelf.Get() * 60 + (uint32_t)diSecSelf.Get());
 
diFramesLeft.Set(diFramesCount.Get());
diLeftTimer.Set(self_timeout);
diIntTimer.Set(intr_timeout);
 
SetEvt setEvt;
setEvt.sig = SET_FRAMES_SIG;
setEvt.value = diFramesCount.Get();
hdrCapture.dispatch(&setEvt);
setEvt.sig = SET_FRAME_TIMEOUT_SIG;
setEvt.value = intr_timeout;
hdrCapture.dispatch(&setEvt);
setEvt.sig = SET_SELF_TIMEOUT_SIG;
setEvt.value = self_timeout;
hdrCapture.dispatch(&setEvt);
SetBktEvt setBktEvt;
setBktEvt.sig = SET_BRACKETING_SIG;
setBktEvt.step = nBktStep;
setBktEvt.negative = nBktNegativeIndex;
setBktEvt.positive = nBktPositiveIndex;
hdrCapture.dispatch(&setBktEvt);
StateMachine::SetState(&runMenu);
setEvt.sig = RUN_SIG;
hdrCapture.dispatch(&setEvt);
};
 
//--- Main Menu ----------------------------------------------------------------------------
void MenuIntervalometer() { StateMachine::SetState(&timerSettingsMenu); };
 
void MenuSettings()
{
StateMachine::SetState(&settingsMenu);
};
 
MenuItem mainMenuItems[] = { {&siIntervalometer, &MenuIntervalometer}, {&siSettings, &MenuSettings} };
Menu mainMenu(1, 2, mainMenuItems, 0);
 
void MenuExit() { StateMachine::SetState(&mainMenu); };
 
class DummyMenu : public StateMachine
{
public:
virtual bool OnInitialState()
{
Screen::Set(0);
return true;
};
} DisconnectedState;
 
void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
{
if (stateConnected)
{
stateConnected = false;
PTPPollTimer.Disable();
StateMachine::SetState(&DisconnectedState);
}
}
 
void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
{
if (!stateConnected)
{
stateConnected = true;
PTPPollTimer.Enable();
StateMachine::SetState(&mainMenu);
}
hdrCapture.Run();
}
 
void CamHDRCapture::OnFrameCaptured(uint16_t left)
{
diFramesLeft.Set(left);
 
if (!left)
StateMachine::SetState(&timerSettingsMenu);
}
 
void CamHDRCapture::OnSelfTimerProgress(uint32_t left)
{
diLeftTimer.Set(left);
}
 
void CamHDRCapture::OnIntrTimerProgress(uint32_t left)
{
diIntTimer.Set(left);
}
 
void OnControlTimer()
{
ExtControls.CheckControls();
hdrCapture.PostEvent(&evtTick);
Screen::Run(&LCD);
}
 
void OnPTPPollTimer()
{
EOSEventParser prs;
Eos.EventCheck(&prs);
diLeftTimer.SetUpdated(true);
diIntTimer.SetUpdated(true);
}
 
void setup()
{
StateMachine::SetState(&DisconnectedState);
#ifdef PTPDEBUG
Serial.begin(115200);
#endif
 
Eos.Setup();
delay( 200 );
// set up the LCD's number of rows and columns:
LCD.begin(16, 2);
LCD.clear();
LCD.home();
LCD.setCursor(0,0);
PTPPollTimer.Set(OnPTPPollTimer, 300);
// 1ms is the perfect interval for encoder polling
ControlTimer.Set(OnControlTimer, 1);
ControlTimer.Enable();
evtTick.sig = TICK_MILLIS_SIG;
evtAbort.sig = ABORT_SIG;
hdrCapture.init();
 
#ifdef PTPDEBUG
Serial.println("Start");
#endif
}
 
void loop()
{
Eos.Task();
PTPPollTimer.Run();
ControlTimer.Run();
}
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/camcontroller.h
0,0 → 1,49
/* Camera controller header */
#ifndef __CAMCONTROLLER_H__
#define __CAMCONTROLLER_H__
 
#include <inttypes.h>
#include <avr/pgmspace.h>
 
#include <canoneos.h>
#include <eosvaluetitles.h>
#include "menu.h"
 
const char msgSetSelf[] PROGMEM = "SELF";
const char msgSetFrames[] PROGMEM = "FRMS";
const char msgSetBkt[] PROGMEM = "BKT";
const char msgSetInterval[] PROGMEM = "INT";
const char msgExit[] PROGMEM = "EXIT";
const char msgSetRun[] PROGMEM = "RUN ";
const char msgAbort[] PROGMEM = "ABORT";
const char msgLeft[] PROGMEM = "LEFT";
 
const char msgError[] PROGMEM = "ERROR:";
const char msgCamera[] PROGMEM = "CAMERA";
const char msgDisconnected[] PROGMEM = "DISCONNECTED";
 
const char msgSelfTimer[] PROGMEM = "SELF TIMER h/m/s";
const char msgBracketing[] PROGMEM = "BKT(RANGE/STEP)";
const char msgSteps[] PROGMEM = "steps";
const char msgCntFrames[] PROGMEM = "FRAMES";
const char msgIntTimer[] PROGMEM = "INT TIMER h/m/s";
const char msgIntervalometer[] PROGMEM = "INTERVAL";
const char msgSettings[] PROGMEM = "SETTINGS";
const char msgClock[] PROGMEM = "CLOCK";
const char msgEV[] PROGMEM = "EV";
 
typedef KeyValuePairDataItem<VT_EXPCOMP, VT_EXPCOMP_COUNT, VT_EXPCOMP_TEXT_LEN> EXP_COMP_DATA_ITEM; // Exposure compensation data item type
typedef SRAMValueList<VT_EXPCOMP, 16> BKT_STEP_VALUE_LIST; // Bracketing step value list type
 
//--- Data Item Types ---------------------------------------------------------
typedef KeyValuePairDataItem<VT_MODE, VT_MODE_COUNT, VT_MODE_TEXT_LEN> DIT_MODE;
typedef KeyValuePairDataItem<VT_APERTURE, VT_APT_COUNT, VT_APT_TEXT_LEN> DIT_APERTURE;
typedef KeyValuePairDataItem<VT_WB, VT_WB_COUNT, VT_WB_TEXT_LEN> DIT_WB;
typedef KeyValuePairDataItem<VT_SHSPEED, VT_SHSPEED_COUNT, VT_SHSPEED_TEXT_LEN> DIT_SHUTTER_SPEED;
typedef KeyValuePairDataItem<VT_PSTYLE, VT_PSTYLE_COUNT, VT_PSTYLE_TEXT_LEN> DIT_PSTYLE;
typedef KeyValuePairDataItem<VT_ISO, VT_ISO_COUNT, VT_ISO_TEXT_LEN> DIT_ISO;
typedef KeyValuePairDataItem<VT_EXPCOMP, VT_EXPCOMP_COUNT, VT_EXPCOMP_TEXT_LEN> DIT_EXPCOMP;
typedef IntDataItem<uint8_t, 3> DIT_TIMER_DIGIT_PAIR;
 
 
#endif //__CAMCONTROLLER_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/controls.cpp
0,0 → 1,50
#include <Max3421e.h>
#include "controls.h"
 
StateMachine* StateMachine::currentState = NULL;
 
void GPInRegister::CheckControls()
{
int8_t enc_states[] = {0,-1,1,0,1,0,0,-1,-1,0,0,1,0,1,-1,0};
ControlStates previous = controlStates;
controlStates = (pMax->gpioRd() & (GPIN_ENCODER_MASK | GPIN_ENC_BUT_MASK | GPIN_EXT_BUT_MASK));
ControlStates changes = (previous ^ controlStates);
if (previous == controlStates)
return;
ControlEvents *state_machine = (ControlEvents*)StateMachine::GetState();
if ((changes & GPIN_ENCODER_MASK))
{
uint8_t encoder = (previous & GPIN_ENCODER_MASK);
encoder <<= 2;
encoder |= (controlStates & GPIN_ENCODER_MASK);
encoderValue += enc_states[(encoder & 0x0f)];
if (encoderValue > 3 || encoderValue < -3)
{
if (state_machine)
state_machine->OnEncoderChanged(encoderValue >> 2);
encoderValue = 0;
}
}
if (!state_machine)
return;
if ((changes & GPIN_ENC_BUT_MASK))
{
if ((controlStates & GPIN_ENC_BUT_MASK))
state_machine->OnEncButtonUp();
else
state_machine->OnEncButtonDown();
}
if ((changes & GPIN_EXT_BUT_MASK))
{
if ((controlStates & GPIN_EXT_BUT_MASK))
state_machine->OnExtButtonUp();
else
state_machine->OnExtButtonDown();
}
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/controls.h
0,0 → 1,50
#ifndef __CONTROLS_H__
#define __CONTROLS_H__
 
#include <inttypes.h>
#include <avr/pgmspace.h>
 
class StateMachine
{
static StateMachine *currentState;
protected:
virtual bool OnInitialState() { return true; };
 
public:
static void SetState(StateMachine *state) { currentState = state; currentState->OnInitialState(); };
static StateMachine* GetState() { return StateMachine::currentState; };
};
 
class ControlEvents : public StateMachine
{
public:
virtual bool OnEncoderChanged(int8_t value) { return true; };
virtual bool OnEncButtonUp() { return true; };
virtual bool OnEncButtonDown() { return true; };
virtual bool OnExtButtonUp() { return true; };
virtual bool OnExtButtonDown() { return true; };
};
 
#define GPIN_ENCODER_MASK 0x03
#define GPIN_ENC_BUT_MASK 0x08
#define GPIN_EXT_BUT_MASK 0x10
 
#define GPIN_ENC_BUT_MASK 0x04
#define GPIN_EXT_BUT_MASK 0x08
 
 
typedef uint8_t ControlStates;
 
class GPInRegister
{
ControlStates controlStates;
MAX3421E *pMax;
int8_t encoderValue;
public:
GPInRegister(MAX3421E *pmax) : controlStates(GPIN_ENCODER_MASK | GPIN_ENC_BUT_MASK | GPIN_EXT_BUT_MASK), pMax(pMax), encoderValue(0) {};
void CheckControls();
};
 
#endif // __CONTROLS_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/dataitem.cpp
0,0 → 1,51
#include "dataitem.h"
 
char TimeSpanDataItem::textValue[9] = "";
char TimerDataItem::textValue[9] = "";
 
char* itoa2(int val, uint8_t buf_size, char *buf, int8_t base, char c)
{
char sign = (val < 0) ? '-' : c;
buf[buf_size-1] = 0;
 
int8_t i = buf_size-2;
for(; val && i ; --i, val /= base)
buf[i] = "0123456789abcdef"[(val < 0) ? -(val % base) : val % base];
for (; i > 0; i--)
buf[i] = c;
buf[0] = sign;
return buf;
}
 
char* itoa2(uint8_t val, uint8_t buf_size, char *buf, int8_t base, char c)
{
buf[buf_size-1] = 0;
 
int8_t i = buf_size-2;
for(; val && i>=0 ; --i, val /= base)
buf[i] = "0123456789abcdef"[(val < 0) ? -(val % base) : val % base];
for (; i >= 0; i--)
buf[i] = c;
return buf;
}
 
char* itoa2(uint16_t val, uint8_t buf_size, char *buf, int8_t base, char c)
{
buf[buf_size-1] = 0;
 
int8_t i = buf_size-2;
for(; val && i>=0 ; --i, val /= base)
buf[i] = "0123456789abcdef"[val % base];
for (; i >= 0; i--)
buf[i] = c;
return buf;
}
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/dataitem.h
0,0 → 1,194
#if !defined(__DATAITEM_H__)
#define __DATAITEM_H__
 
#include <inttypes.h>
#include <canoneos.h>
#include <SimpleTimer.h>
#include <valuelist.h>
 
#define MUL10( a ) (((a) << 3 ) + ((a) << 1 ))
 
char* itoa2(int val, uint8_t buf_size, char *buf, int8_t base, char c);
char* itoa2(uint8_t val, uint8_t buf_size, char *buf, int8_t base, char c);
char* itoa2(uint16_t val, uint8_t buf_size, char *buf, int8_t base, char c);
 
class DataItemBase
{
protected:
bool isUpdated;
public:
virtual void GetText(char** str, bool &is_pgm) = 0;
bool IsUpdated() { return isUpdated; };
void SetUpdated(bool upd) { isUpdated = upd; };
};
 
class TimeSpanDataItem : public DataItemBase
{
uint32_t dataValue;
static char textValue[9];
public:
TimeSpanDataItem(uint32_t s) : dataValue(s) {};
 
virtual void GetText(char** str, bool &is_pgm)
{
{
uint16_t h = dataValue / 3600;
itoa2((uint16_t) h, 3, (char*)&textValue, 10, '0');
}
{
textValue[2] = ':';
uint16_t s = dataValue % 3600;
itoa2((uint16_t) s / 60, 3, (char*)(textValue+3), 10, '0');
textValue[5] = ':';
itoa2((uint16_t) s % 60, 3, (char*)(textValue+6), 10, '0');
}
*str = textValue;
is_pgm = false;
};
virtual void Set(uint32_t &val)
{
dataValue = val;
isUpdated = true;
};
};
 
#define MUL60( a ) (((a) << 6 ) - ((a) << 2 ))
#define MUL3600( a ) (((a) << 12 ) - ((a) << 9 ) + ((a) << 4 ))
 
class TimerDataItem : public DataItemBase
{
SimpleTimer &dataValue;
static char textValue[9];
public:
TimerDataItem(SimpleTimer &t) : dataValue(t) {};
 
virtual void GetText(char** str, bool &is_pgm)
{
uint16_t time_left = dataValue.TimeLeft() / 1000;
uint16_t ss = time_left % 60;
time_left /= 60;
uint16_t mm = time_left % 60;
time_left /= 60;
uint16_t hh = time_left;
itoa2((uint16_t)hh, 3, (char*)&textValue, 10, '0');
textValue[2] = ':';
itoa2((uint16_t)mm, 3, (char*)(textValue+3), 10, '0');
textValue[5] = ':';
itoa2((uint16_t)ss, 3, (char*)(textValue+6), 10, '0');
*str = textValue;
is_pgm = false;
};
};
 
template <class VALUE_TYPE, const uint8_t TABLE_SIZE, const uint8_t TEXT_SIZE>
class KeyValuePairDataItem : public DataItemBase
{
VALUE_TYPE dataValue;
const ValueTitle<VALUE_TYPE, TEXT_SIZE> *ptrTitles;
public:
KeyValuePairDataItem(VALUE_TYPE val, const ValueTitle<VALUE_TYPE, TEXT_SIZE> *p) : dataValue(val), ptrTitles(p)
{};
virtual void GetText(char** str, bool &is_pgm)
{
*str = (char*)FindTitle<VALUE_TYPE, TEXT_SIZE>(TABLE_SIZE, ptrTitles, dataValue);
is_pgm = true;
};
VALUE_TYPE Get() { return dataValue; };
void Set(VALUE_TYPE val) { dataValue = val; isUpdated = true; };
};
 
template <class VALUE_TYPE, const uint8_t TEXT_LEN>
class IntDataItem : public DataItemBase
{
VALUE_TYPE dataValue;
static char valString[TEXT_LEN];
public:
IntDataItem() : dataValue(0) { isUpdated = true; };
IntDataItem(VALUE_TYPE data) : dataValue(data) {};
virtual void Set(VALUE_TYPE data)
{
dataValue = data;
isUpdated = true;
};
VALUE_TYPE Get() { return dataValue; };
virtual void GetText(char** str, bool &is_pgm)
{
*str = itoa2(dataValue, TEXT_LEN, (char*)&valString, 10, '0');
is_pgm = false;
};
void operator ++(int val)
{
dataValue += val;
isUpdated = true;
};
void operator --(int val)
{
dataValue -= val;
isUpdated = true;
};
};
 
template <class VALUE_TYPE, const uint8_t TEXT_LEN>
char IntDataItem<VALUE_TYPE,TEXT_LEN>::valString[TEXT_LEN] = "";
 
class PgmStringDataItem : public DataItemBase
{
const char *pStr;
public:
PgmStringDataItem(const char *str) : pStr(str) { isUpdated = true; };
void SetText(const char *str) { pStr = str; isUpdated = true; };
virtual void GetText(char** str, bool &is_pgm)
{
*str = (char*)pStr;
is_pgm = true;
};
};
 
template <const uint8_t STRLEN>
class StringDataItem : public DataItemBase
{
char theString[STRLEN];
void CopyString(char *src, char *dst)
{
char *s = src, *d = dst;
for (uint8_t cnt = 0; *s && cnt < STRLEN-1; cnt++, s++, d++)
*d = *s;
*d = 0;
};
public:
StringDataItem() { theString[0] = 0; isUpdated = true; };
StringDataItem(char *str) { CopyString(str, &theString); isUpdated = true; };
 
void SetText(char *str) { CopyString(str, &theString); isUpdated = true; };
virtual void GetText(char** str, bool &is_pgm)
{
*str = &theString;
is_pgm = false;
};
};
 
 
#endif // __DATAITEM_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/eoseventparser.cpp
0,0 → 1,191
#include "eoseventparser.h"
#include "dataitem.h"
#include "camcontroller.h"
 
extern DIT_MODE diMode;
extern DIT_APERTURE diAperture;
extern DIT_WB diWb;
extern DIT_SHUTTER_SPEED diShutterSpeed;
extern DIT_PSTYLE diPStyle;
extern DIT_ISO diIso;
extern DIT_EXPCOMP diExpComp;
 
extern EEPROMByteList vlAperture;
extern EEPROMByteList vlShutterSpeed;
extern EEPROMByteList vlWhiteBalance;
extern EEPROMByteList vlPictureStyle;
extern EEPROMByteList vlExpCompensation;
extern EEPROMByteList vlIso;
 
bool EOSEventParser::EventRecordParse(uint8_t **pp, uint16_t *pcntdn)
{
switch (nRecStage)
{
case 0:
// Retrieves the size of the event record
if (!valueParser.Parse(pp, pcntdn))
return false;
 
nRecSize = (uint16_t)varBuffer;
 
// calculates the number of event parameters ( size / 4 - 1 )
paramCountdown = (nRecSize >> 2) - 1;
paramCount = 1;
nRecSize -= 4;
nRecStage ++;
case 1:
for (; paramCountdown; paramCountdown--, paramCount++, nRecSize -= 4)
{
if (!valueParser.Parse(pp, pcntdn))
return false;
 
switch (paramCount)
{
// Event Code
case 1:
eosEvent.eventCode = (uint16_t)varBuffer;
break;
// Property Code
case 2:
// if (eosEvent.eventCode == EOS_EC_ObjectCreated)
// {
// }
eosEvent.propCode = (uint16_t)varBuffer;
break;
// C189 - Property Value, C18A - Enumerator Type
case 3:
eosEvent.propValue = varBuffer;
if (eosEvent.eventCode == EOS_EC_DevPropChanged)
{
switch (eosEvent.propCode)
{
case EOS_DPC_Aperture:
diAperture.Set(varBuffer);
break;
case EOS_DPC_ShutterSpeed:
diShutterSpeed.Set(varBuffer);
break;
case EOS_DPC_ShootingMode:
diMode.Set(varBuffer);
break;
case EOS_DPC_WhiteBalance:
diWb.Set(varBuffer);
break;
case EOS_DPC_PictureStyle:
diPStyle.Set(varBuffer);
break;
case EOS_DPC_Iso:
diIso.Set(varBuffer);
break;
case EOS_DPC_ExposureCompensation:
diExpComp.Set(varBuffer);
break;
};
}
break;
// C18A/enumType == 3 - Size of enumerator array
case 4:
if (eosEvent.eventCode == EOS_EC_DevPropValuesAccepted)
{
switch (eosEvent.propCode)
{
case EOS_DPC_Aperture:
vlAperture.SetSize((uint8_t)varBuffer);
break;
case EOS_DPC_ShutterSpeed:
vlShutterSpeed.SetSize((uint8_t)varBuffer);
break;
case EOS_DPC_WhiteBalance:
vlWhiteBalance.SetSize((uint8_t)varBuffer);
break;
case EOS_DPC_PictureStyle:
vlPictureStyle.SetSize((uint8_t)varBuffer);
break;
case EOS_DPC_Iso:
vlIso.SetSize((uint8_t)varBuffer);
break;
case EOS_DPC_ExposureCompensation:
vlExpCompensation.SetSize((uint8_t)varBuffer);
break;
};
}
break;
// C18A/enumType == 3 - Enumerator Values
default:
if (eosEvent.eventCode == EOS_EC_DevPropValuesAccepted)
{
switch (eosEvent.propCode)
{
case EOS_DPC_Aperture:
vlAperture.Set(paramCount-5, (uint8_t)varBuffer);
break;
case EOS_DPC_ShutterSpeed:
vlShutterSpeed.Set(paramCount-5, (uint8_t)varBuffer);
break;
case EOS_DPC_WhiteBalance:
vlWhiteBalance.Set(paramCount-5, (uint8_t)varBuffer);
break;
case EOS_DPC_PictureStyle:
vlPictureStyle.Set(paramCount-5, (uint8_t)varBuffer);
break;
case EOS_DPC_ExposureCompensation:
vlExpCompensation.Set(paramCount-5, (uint8_t)varBuffer);
break;
case EOS_DPC_Iso:
vlIso.Set(paramCount-5, (uint8_t)varBuffer);
break;
} // switch (eosEvent.propCode)
}
} // switch (paramCount)
} // for
nRecStage ++;
case 2:
if (nRecSize)
if (!byteSkipper.Skip(pp, pcntdn, nRecSize))
return false;
 
nRecSize = 0;
nRecStage = 0;
}
return true;
}
 
void EOSEventParser::InitEOSEventStruct()
{
eosEvent.eventCode = constInitialEventCode;
eosEvent.propCode = 0;
eosEvent.propValue = 0;
}
 
 
void EOSEventParser::Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset)
{
uint8_t *p = (uint8_t*) pbuf;
uint16_t cntdn = len;
 
switch (nStage)
{
case 0:
p += 12;
cntdn -= 12;
nStage ++;
case 1:
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
InitEOSEventStruct();
nStage ++;
case 2:
while (1)
{
if (!EventRecordParse(&p, &cntdn))
return;
if (IsLastEventRecord())
break;
InitEOSEventStruct();
}
nStage = 0;
}
}
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/eoseventparser.h
0,0 → 1,75
#ifndef __EOSEVENTPARSER_H__
#define __EOSEVENTPARSER_H__
 
#include <inttypes.h>
#include <avr/pgmspace.h>
#include <Max_LCD.h>
#include <ptpcallback.h>
#include <canoneos.h>
 
 
struct EOSParamValues
{
uint8_t upperValue;
uint8_t currentValue;
uint8_t lowerValue;
};
 
#define MAX_OBJ_IN_LIST 8
 
class EOSEventParser : public PTPReadParser
{
const uint16_t constInitialEventCode;
 
uint8_t paramsChanged;
 
struct EOSEvent
{
uint16_t eventCode;
uint16_t propCode;
uint32_t propValue;
};
 
uint8_t nStage;
uint8_t nRecStage;
uint16_t nRecSize;
MultiValueBuffer theBuffer;
uint32_t varBuffer;
EOSEvent eosEvent;
uint16_t paramCountdown;
uint16_t paramCount;
 
MultiByteValueParser valueParser;
ByteSkipper byteSkipper;
 
bool EventRecordParse(uint8_t **pp, uint16_t *pcntdn);
bool IsLastEventRecord() { return (eosEvent.eventCode == 0); };
void InitEOSEventStruct();
 
public:
EOSEventParser() :
constInitialEventCode(0xFFFF),
nStage(0),
nRecStage(0),
nRecSize(0),
varBuffer(0),
paramCountdown(0),
paramsChanged(0)
{
theBuffer.pValue = &varBuffer;
};
 
void Reset()
{
nStage = 0;
nRecStage = 0;
nRecSize = 0;
varBuffer = 0;
paramCountdown = 0;
paramsChanged = 0;
};
 
virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset);
};
 
#endif // __EOSEVENTPARSER_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/expcomp_macro.h
0,0 → 1,3
extern EEPROMByteList vlExpCompensation;
 
#define EXP_COMP_VALUE(i)((uint32_t)vlExpCompensation.Get((i)))
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/hdrcapture.cpp
0,0 → 1,336
#include "hdrcapture.h"
#include "expcomp_macro.h"
 
/* fixes avr-gcc incompatibility with virtual destructors */
void operator delete( void *p ) {}
 
QState HDRCapture::Initial(HDRCapture *me, QEvent const *e)
{
return Q_TRAN(&HDRCapture::Inactive);
}
 
QState HDRCapture::Inactive(HDRCapture *me, QEvent const *e)
{
switch(e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("Inactive\r\n");
return Q_HANDLED();
case SET_FRAMES_SIG:
me->frmCount = (uint16_t)((SetEvt*)e)->value;
return Q_HANDLED();
case SET_SELF_TIMEOUT_SIG:
me->selfTimeout = ((SetEvt*)e)->value;
return Q_HANDLED();
case SET_FRAME_TIMEOUT_SIG:
me->frameTimeout = ((SetEvt*)e)->value;
return Q_HANDLED();
case SET_BRACKETING_SIG:
me->bktStep = ((SetBktEvt*)e)->step;
me->bktNegative = ((SetBktEvt*)e)->negative;
me->bktPositive = ((SetBktEvt*)e)->positive;
return Q_HANDLED();
case RUN_SIG:
me->frmCntdn = me->frmCount;
me->bktCntdn = (me->bktStep) ? (me->bktPositive - me->bktNegative) / me->bktStep + 1 : 1;
me->bktPos = me->bktNegative;
return Q_TRAN(&HDRCapture::Active);
}
return Q_SUPER(&QHsm::top);
}
 
QState HDRCapture::Active(HDRCapture *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("Active\r\n");
return Q_HANDLED();
case Q_EXIT_SIG:
PTPTRACE("::Q_EXIT_SIG\r\n");
return Q_HANDLED();
case Q_INIT_SIG:
PTPTRACE("Q_INIT_SIG\r\n");
return Q_TRAN(&HDRCapture::SaveSettings);
case RUN_SIG:
PTPTRACE("::RUN_SIG\r\n");
return Q_TRAN(&HDRCapture::SaveSettings);
case ABORT_SIG:
PTPTRACE("ABORT_SIG\r\n");
return Q_TRAN(&HDRCapture::RestoreSettings);
case PTP_RC_SIG:
PTPTRACE("::PTP_RC_SIG\r\n");
switch (((PTP_RC_Evt*)e)->rc)
{
case PTP_RC_OK:
me->qpEvt.sig = PTP_RC_OK_SIG;
me->theQueue.Push(&me->qpEvt);
return Q_HANDLED();
case PTP_RC_DeviceBusy:
me->toEvt.timeout = PTP_TIMEOUT;
me->toEvt.attribs = TA_PTP_TIMEOUT;
me->theQueue.Push(&me->toEvt);
return Q_TRAN(&HDRCapture::Timeout);
default:
return Q_TRAN(&HDRCapture::Inactive);
}
case SET_TIMEOUT_SIG:
PTPTRACE("::SET_TIMEOUT_SIG\r\n");
return Q_HANDLED();
case TIMEOUT_SIG:
PTPTRACE("::TIMEOUT_SIG\r\n");
return Q_TRAN(me->activeHistory);
case PTP_RC_OK_SIG:
PTPTRACE("::PTP_RC_OK_SIG\r\n");
return Q_TRAN(me->activeHistory);
case TICK_MILLIS_SIG:
PTPTRACE("::TICK_MILLIS_SIG\r\n");
return Q_HANDLED();
}
return Q_SUPER(&QHsm::top);
}
 
QState HDRCapture::SaveSettings(HDRCapture *me, QEvent const *e)
{
static bool bSaved = false;
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("SaveSettings\r\n");
me->activeHistory = (QStateHandler)&SaveSettings;
// me->rcEvt.rc = me->Eos.GetProperty(EOS_DPC_ExposureCompensation, me->bktOldVal);
me->rcEvt.rc = PTP_RC_OK;
me->theQueue.Push(&me->rcEvt);
me->bktOldVal = (uint8_t)0;
return Q_HANDLED();
case PTP_RC_OK_SIG:
PTPTRACE("PTP_RC_OK_SIG\r\n");
if (me->selfTimeout)
{
me->theQueue.Push((QEvent*)e);
return Q_TRAN(&HDRCapture::SelfTimer);
}
return Q_TRAN(&HDRCapture::PreCapture);
} // switch
return Q_SUPER(&HDRCapture::Active);
}
 
QState HDRCapture::SelfTimer(HDRCapture *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("SelfTimer\r\n");
me->activeHistory = (QStateHandler)&SelfTimer;
return Q_HANDLED();
case TICK_MILLIS_SIG:
PTPTRACE("TICK_MILLIS_SIG\r\n");
return Q_TRAN(&HDRCapture::PreCapture);
case PTP_RC_OK_SIG:
PTPTRACE("PTP_RC_OK_SIG\r\n");
me->toEvt.timeout = me->selfTimeout;
me->toEvt.attribs = TA_SELF_TIMER;
me->theQueue.Push(&me->toEvt);
return Q_TRAN(&HDRCapture::Timeout);
case TIMEOUT_SIG:
PTPTRACE("TIMEOUT_SIG\r\n");
return Q_TRAN(&HDRCapture::PreCapture);
} // switch
return Q_SUPER(&HDRCapture::Active);
}
 
QState HDRCapture::RestoreSettings(HDRCapture *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("RestoreSettings\r\n");
me->activeHistory = (QStateHandler)&RestoreSettings;
me->rcEvt.rc = me->Eos.SetProperty(EOS_DPC_ExposureCompensation, me->bktOldVal);
me->theQueue.Push(&me->rcEvt);
return Q_HANDLED();
case PTP_RC_OK_SIG:
return Q_TRAN(&HDRCapture::Inactive);
} // switch
return Q_SUPER(&HDRCapture::Active);
}
 
QState HDRCapture::PreCapture(HDRCapture *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("PreCapture\r\n");
me->activeHistory = (QStateHandler)&PreCapture;
return Q_HANDLED();
case TICK_MILLIS_SIG:
PTPTRACE("TICK_MILLIS_SIG\r\n");
if (!me->bktCntdn)
{
me->bktCntdn = (me->bktStep) ? (me->bktPositive - me->bktNegative) / me->bktStep + 1 : 1;
me->bktPos = me->bktNegative;
}
if (me->bktStep)
return Q_TRAN(&HDRCapture::ExpCompSet);
return Q_TRAN(&HDRCapture::Capture);
} // switch
return Q_SUPER(&HDRCapture::Active);
}
 
QState HDRCapture::Capture(HDRCapture *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("Capture\r\n");
me->activeHistory = (QStateHandler)&Capture;
me->rcEvt.rc = me->Eos.Capture();
// me->rcEvt.rc = PTP_RC_OK;
me->theQueue.Push(&me->rcEvt);
return Q_HANDLED();
case PTP_RC_OK_SIG:
PTPTRACE("PTP_RC_OK_SIG\r\n");
return Q_TRAN(&HDRCapture::PostCapture);
} // switch
return Q_SUPER(&HDRCapture::Active);
}
 
QState HDRCapture::PostCapture(HDRCapture *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("PostCapture\r\n");
me->activeHistory = (QStateHandler)&PostCapture;
return Q_HANDLED();
case TICK_MILLIS_SIG:
PTPTRACE("TICK_MILLIS_SIG\r\n");
 
if (!me->bktCntdn)
return Q_TRAN(&HDRCapture::PreCapture);
 
me->bktPos += me->bktStep;
if (--me->bktCntdn == 0)
{
--me->frmCntdn;
me->OnFrameCaptured(me->frmCntdn);
}
me->OnBktFrameCaptured(me->bktCntdn);
 
// if it was the last frame in total
if (!me->frmCntdn)
{
me->qpEvt.sig = ABORT_SIG;
me->theQueue.Push(&me->qpEvt);
return Q_HANDLED();
}
if (me->bktCntdn)
return Q_TRAN(&HDRCapture::PreCapture);
 
// if it was the last frame in bracketing
me->toEvt.timeout = me->frameTimeout;
me->toEvt.attribs = TA_INTR_TIMER;
me->theQueue.Push(&me->toEvt);
return Q_TRAN(&HDRCapture::Timeout);
case TIMEOUT_SIG:
PTPTRACE("TIMEOUT_SIG\r\n");
return Q_TRAN(&HDRCapture::PreCapture);
}
return Q_SUPER(&HDRCapture::Active);
}
 
QState HDRCapture::ExpCompSet(HDRCapture *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("ExpCompSet\r\n");
me->activeHistory = (QStateHandler)&ExpCompSet;
me->rcEvt.rc = me->Eos.SetProperty(EOS_DPC_ExposureCompensation, EXP_COMP_VALUE(me->bktPos));
// me->rcEvt.rc = PTP_RC_OK;
me->theQueue.Push(&me->rcEvt);
return Q_HANDLED();
case PTP_RC_OK_SIG:
PTPTRACE("PTP_RC_OK_SIG\r\n");
return Q_TRAN(&HDRCapture::Capture);
} // switch
return Q_SUPER(&HDRCapture::Active);
}
 
QState HDRCapture::Timeout(HDRCapture *me, QEvent const *e)
{
static uint32_t timeout = 0;
static uint32_t local_time = 0;
static uint32_t seconds_left = 0;
static uint8_t attribs = 0;
static uint16_t sec_cntdn = 1000;
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("Timeout\r\n");
return Q_HANDLED();
case SET_TIMEOUT_SIG:
attribs = ((SetTimeoutEvt*)e)->attribs;
timeout = (attribs & 0x01) ? ((SetTimeoutEvt*)e)->timeout * 1000 : ((SetTimeoutEvt*)e)->timeout;
if (attribs & 0x01)
{
seconds_left = ((SetTimeoutEvt*)e)->timeout;
sec_cntdn = 1000;
switch (attribs)
{
case TA_SELF_TIMER:
me->OnSelfTimerProgress(seconds_left);
break;
case TA_INTR_TIMER:
me->OnIntrTimerProgress(seconds_left);
break;
// case TA_BULB_TIMER:
// me->OnBulbTimerProgress(seconds_left);
// break;
} // switch
}
local_time = millis();
return Q_HANDLED();
case TICK_MILLIS_SIG:
uint32_t dt = local_time;
local_time = millis();
dt = local_time - dt;
timeout = (timeout < dt) ? 0 : timeout - dt;
 
if (attribs & 1)
{
bool bTick = (sec_cntdn <= dt);
sec_cntdn = (sec_cntdn > dt) ? sec_cntdn - dt : 1000 - dt;
if (bTick)
{
seconds_left --;
switch (attribs)
{
case TA_SELF_TIMER:
me->OnSelfTimerProgress(seconds_left);
break;
case TA_INTR_TIMER:
me->OnIntrTimerProgress(seconds_left);
break;
} // switch
} // if (--sec_cntdn == 0)
} // if (attribs & 1)
if (!timeout)
{
me->qpEvt.sig = TIMEOUT_SIG;
me->theQueue.Push(&me->qpEvt);
}
return Q_HANDLED();
} // switch
return Q_SUPER(&HDRCapture::Active);
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/hdrcapture.h
0,0 → 1,130
#if !defined(__HDRCAPTURE_H__)
#define __HDRCAPTURE_H__
 
#include <inttypes.h>
#include <avr/pgmspace.h>
#include <qep_port.h>
#include <ptp.h>
#include <canoneos.h>
#include <simplefifo.h>
#include <valuelist.h>
 
#define PTP_TIMEOUT 250
 
#define TA_PTP_TIMEOUT 0x00
#define TA_SELF_TIMER 0x03
#define TA_INTR_TIMER 0x05
#define TA_BULB_TIMER 0x07
 
enum HDRCaptureSignals
{
TICK_MILLIS_SIG = Q_USER_SIG,
SET_FRAMES_SIG,
SET_SELF_TIMEOUT_SIG,
SET_FRAME_TIMEOUT_SIG,
SET_BRACKETING_SIG,
RUN_SIG,
ABORT_SIG,
TIMEOUT_SIG,
SET_TIMEOUT_SIG,
PTP_RC_SIG,
PTP_RC_OK_SIG
};
 
struct SetTimeoutEvt : public QEvent
{
uint32_t timeout;
uint8_t attribs;
};
 
struct SetEvt : public QEvent
{
uint32_t value;
};
 
struct SetBktEvt : public QEvent
{
uint8_t step;
uint8_t negative;
uint8_t positive;
};
 
struct PTP_RC_Evt : public QEvent
{
uint16_t rc;
};
 
class HDRCapture : public QHsm
{
uint16_t frmCntdn;
uint16_t frmCount;
uint32_t selfTimeout;
uint32_t frameTimeout;
uint8_t bktStep;
uint8_t bktNegative;
uint8_t bktPositive;
uint8_t bktCntdn;
uint8_t bktPos;
uint8_t bktOldVal;
CanonEOS &Eos;
SetTimeoutEvt toEvt;
PTP_RC_Evt rcEvt;
QEvent qpEvt;
QStateHandler activeHistory;
 
SimpleFIFO<QEvent*, 4> theQueue;
public:
HDRCapture(CanonEOS &eos) :
QHsm((QStateHandler)&HDRCapture::Initial),
frmCount(0),
frmCntdn(0),
selfTimeout(0),
frameTimeout(0),
bktStep(0),
bktNegative(0),
bktPositive(0),
bktCntdn(0),
bktPos(0),
bktOldVal(0),
Eos(eos),
activeHistory(NULL)
{
toEvt.sig = SET_TIMEOUT_SIG;
rcEvt.sig = PTP_RC_SIG;
};
void PostEvent(QEvent *e)
{
theQueue.Push(e);
};
void Run()
{
QEvent *e = NULL;
while ( (e = theQueue.Pop()) )
dispatch(e);
};
 
protected:
static QState Initial(HDRCapture *me, QEvent const *e);
static QState Inactive(HDRCapture *me, QEvent const *e);
static QState Active(HDRCapture *me, QEvent const *e);
static QState SelfTimer(HDRCapture *me, QEvent const *e);
static QState PreCapture(HDRCapture *me, QEvent const *e);
static QState Capture(HDRCapture *me, QEvent const *e);
static QState PostCapture(HDRCapture *me, QEvent const *e);
static QState ExpCompSet(HDRCapture *me, QEvent const *e);
static QState SaveSettings(HDRCapture *me, QEvent const *e);
static QState RestoreSettings(HDRCapture *me, QEvent const *e);
static QState Timeout(HDRCapture *me, QEvent const *e);
virtual void OnFrameCaptured(uint16_t left) {};
virtual void OnBktFrameCaptured(uint16_t left) {};
virtual void OnSelfTimerProgress(uint32_t left) {};
virtual void OnIntrTimerProgress(uint32_t left) {};
};
 
#endif // __HDRCAPTURE_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/menu.cpp
0,0 → 1,39
#include "menu.h"
 
bool Menu::OnInitialState()
{
menuItems[itemSelected].screenItem->Highlight(true);
Screen::Set(screenId);
return true;
};
 
bool Menu::OnEncoderChanged(int8_t value)
{
menuItems[itemSelected].screenItem->Highlight(false);
int8_t new_val = (int8_t)itemSelected + value;
if (new_val < 0)
itemSelected = 0;
else if (new_val >= numItems)
itemSelected = numItems - 1;
else
itemSelected = (uint8_t)new_val;
menuItems[itemSelected].screenItem->Highlight(true);
 
return true;
};
 
bool Menu::OnEncButtonDown()
{
if (menuItems[itemSelected].ptrFunction)
(menuItems[itemSelected].ptrFunction)();
};
 
bool Menu::OnExtButtonDown()
{
if (returnState)
StateMachine::SetState(returnState);
};
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/menu.h
0,0 → 1,200
#if !defined(__MENU_H__)
#define __MENU_H__
 
#include <inttypes.h>
#include "screenitem.h"
#include "screen.h"
#include "controls.h"
 
typedef void (*MenuFunctionPtr)();
 
struct MenuItem
{
ScreenItem *screenItem;
MenuFunctionPtr ptrFunction;
};
 
class Menu : public ControlEvents
{
uint8_t numItems;
uint8_t itemSelected;
uint8_t screenId;
MenuItem *menuItems;
StateMachine *returnState;
public:
Menu(uint8_t scr, uint8_t num_items, MenuItem *items, uint8_t sel = 0, StateMachine *s = NULL) :
screenId(scr),
numItems(num_items),
menuItems(items),
itemSelected(sel),
returnState(s)
{};
void SetReturnState(StateMachine *s) { returnState = s; };
virtual bool OnInitialState();
virtual bool OnEncoderChanged(int8_t value);
virtual bool OnEncButtonDown();
virtual bool OnExtButtonDown();
};
 
typedef void (*SpinFunction)(DataItemBase *data_item);
 
template <class ITEM_TYPE, class VALUE_TYPE>
class IntSpin : public ControlEvents
{
VALUE_TYPE minValue;
VALUE_TYPE maxValue;
VALUE_TYPE incValue;
ITEM_TYPE *dataItem;
StateMachine *returnState;
SpinFunction pFunction;
 
public:
IntSpin(VALUE_TYPE min_val, VALUE_TYPE max_val, VALUE_TYPE inc_val, ITEM_TYPE *item, SpinFunction f) :
minValue(min_val),
maxValue(max_val),
incValue(inc_val),
dataItem(item),
returnState(NULL),
pFunction(f)
{
};
void SetConstraints(VALUE_TYPE min_val, VALUE_TYPE max_val, VALUE_TYPE inc_val)
{
minValue = min_val;
maxValue = max_val;
incValue = inc_val;
};
void SetReturnState(StateMachine *s) { returnState = s; };
virtual bool OnEncoderChanged(int8_t value)
{
int16_t new_val = dataItem->Get() + value * incValue;
if (new_val > maxValue)
new_val = maxValue;
else if (new_val < minValue)
new_val = minValue;
dataItem->Set((VALUE_TYPE)new_val);
dataItem->SetUpdated(true);
return true;
};
 
virtual bool OnEncButtonDown()
{
if (pFunction)
pFunction((DataItemBase*)dataItem);
if (returnState)
StateMachine::SetState(returnState);
return true;
};
};
 
template <class ITEM_TYPE, class VALUE_TYPE>
class EEPROMListIntSpin : public ControlEvents
{
EEPROMByteList *valueList;
ITEM_TYPE *dataItem;
StateMachine *returnState;
SpinFunction pFunction;
public:
EEPROMListIntSpin(EEPROMByteList *list, ITEM_TYPE *item, SpinFunction pf) :
valueList(list),
dataItem(item),
returnState(NULL),
pFunction(pf)
{
};
void SetReturnState(StateMachine *s) { returnState = s; };
virtual bool OnEncoderChanged(int8_t value)
{
if (valueList->GetSize() < 1)
return true;
VALUE_TYPE new_value;
if (value < 0)
new_value = valueList->GetPrev(dataItem->Get(), -value);
else
new_value = valueList->GetNext(dataItem->Get(), value);
dataItem->Set(new_value);
dataItem->SetUpdated(true);
return true;
};
 
virtual bool OnEncButtonDown()
{
if (pFunction)
pFunction((DataItemBase*)dataItem);
if (returnState)
StateMachine::SetState(returnState);
return true;
};
};
 
 
template <class ITEM_TYPE, class VALUE_TYPE, class VALUE_LIST_TYPE>
class SRAMListIntSpin : public ControlEvents
{
VALUE_LIST_TYPE *valueList;
ITEM_TYPE *dataItem;
StateMachine *returnState;
SpinFunction pFunction;
public:
SRAMListIntSpin(VALUE_LIST_TYPE *list, ITEM_TYPE *item, SpinFunction pf) :
valueList(list),
dataItem(item),
returnState(NULL),
pFunction(pf)
{
};
void SetReturnState(StateMachine *s) { returnState = s; };
virtual bool OnEncoderChanged(int8_t value)
{
if (valueList->GetSize() < 1)
return true;
VALUE_TYPE new_value;
if (value < 0)
new_value = valueList->GetPrev(dataItem->Get(), -value);
else
new_value = valueList->GetNext(dataItem->Get(), value);
dataItem->Set(new_value);
dataItem->SetUpdated(true);
return true;
};
 
virtual bool OnEncButtonDown()
{
if (pFunction)
pFunction((DataItemBase*)dataItem);
if (returnState)
StateMachine::SetState(returnState);
return true;
};
};
 
#endif // __MENU_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/screen.cpp
0,0 → 1,43
#include "screen.h"
 
uint8_t Screen::currentScreen = 0;
uint8_t Screen::totalScreens = 0;
bool Screen::screenChanged = true;
 
Screen::Screen(const uint8_t num_items, ScreenItem *pItems) : numItems(num_items)
{
screenItems = (ScreenItem*)pgm_read_word(pItems);
if (totalScreens < MAX_SCREENS)
screenPool2[totalScreens++] = this;
};
 
void Screen::Update(Max_LCD *pLcd, bool initial)
{
for (uint8_t i=0; i<numItems; i++)
screenItems[i].Update(pLcd, initial);
};
 
void Screen::Set(uint8_t screen_id)
{
if (screen_id >= totalScreens)
return;
currentScreen = screen_id;
screenChanged = true;
};
 
void Screen::Run(Max_LCD *pLcd)
{
if (screenChanged)
{
pLcd->clear();
pLcd->home();
}
if (screenPool2[currentScreen])
{
screenPool2[currentScreen]->Update(pLcd, (screenChanged) ? true : false);
screenChanged = false;
}
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/screen.h
0,0 → 1,32
#if !defined(__SCREEN_H__)
#define __SCREEN_H__
 
#include <inttypes.h>
#include "screenitem.h"
 
#define MAX_SCREENS 12
 
class Screen;
 
static Screen *screenPool2[MAX_SCREENS];
 
class Screen
{
static uint8_t currentScreen;
static uint8_t totalScreens;
static bool screenChanged;
ScreenItem *screenItems;
const uint8_t numItems;
public:
Screen(const uint8_t num_items, ScreenItem *pItems);
static void Run(Max_LCD *pLcd);
static void Set(uint8_t screen_id);
static uint8_t Get() { return currentScreen; };
void Update(Max_LCD *pLcd, bool initial);
};
 
#endif // __SCREEN_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/screenitem.cpp
0,0 → 1,89
#include "screenitem.h"
 
void ScreenItem::SetAttribs(uint8_t left, uint8_t top, uint8_t len, bool highlighted, bool pgm)
{
itemAttribs.bmLeft = left;
itemAttribs.bmTop = top;
itemAttribs.bmLen = len;
itemAttribs.bmHighlighted = (highlighted) ? 1 : 0;
itemAttribs.bmHlChanged = 1; // item highlighting changed flag
itemAttribs.bmPgmString = (pgm) ? 1 : 0;
};
 
ScreenItem::ScreenItem(uint8_t left, uint8_t top, uint8_t len, bool highlighted, DataItemBase *item) :
dataItem(item)
{
SetAttribs(left, top, len, highlighted, 0);
}
 
ScreenItem::ScreenItem(uint8_t left, uint8_t top, uint8_t len, bool highlighted, const char *item) :
dataItem((void*)item)
{
SetAttribs(left, top, len, highlighted, 1);
}
 
void ScreenItem::Print(Max_LCD *p)
{
char* str;
bool is_pgm = false;
if (itemAttribs.bmPgmString == 1)
{
is_pgm = true;
str = (char*)dataItem;
}
else
((DataItemBase*)dataItem)->GetText(&str, is_pgm);
if(!str)
return;
uint8_t cnt = 0;
if (is_pgm)
{
char c;
while((c = pgm_read_byte(str++)) && cnt < itemAttribs.bmLen)
{
p->print(c,BYTE);
cnt ++;
}
}
else
{
char *pc = str;
while(*pc && cnt < itemAttribs.bmLen)
{
p->print(*pc++,BYTE);
cnt ++;
}
}
}
 
void ScreenItem::Update(Max_LCD *pLcd, bool initial)
{
if (initial || ( itemAttribs.bmPgmString == 0 && ((DataItemBase*)dataItem)->IsUpdated() ) || itemAttribs.bmHlChanged)
{
pLcd->home();
if (itemAttribs.bmLeft > 0)
{
pLcd->setCursor(itemAttribs.bmLeft-1, itemAttribs.bmTop);
pLcd->print((itemAttribs.bmHighlighted) ? '>' : ' ', BYTE);
}
else
pLcd->setCursor(itemAttribs.bmLeft, itemAttribs.bmTop);
Print(pLcd);
if (itemAttribs.bmLeft + itemAttribs.bmLen < 16)
pLcd->print((itemAttribs.bmHighlighted) ? '<' : ' ', BYTE);
if (itemAttribs.bmPgmString == 0)
((DataItemBase*)dataItem)->SetUpdated(false);
itemAttribs.bmHlChanged = 0;
}
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCamController/screenitem.h
0,0 → 1,36
#if !defined(__SCREENITEM_H__)
#define __SCREENITEM_H__
 
#include <inttypes.h>
#include <Max_LCD.h>
#include "dataitem.h"
 
struct ScreenItemAttributes
{
uint16_t bmLeft : 4;
uint16_t bmTop : 2;
uint16_t bmLen : 5;
uint16_t bmHighlighted : 1;
uint16_t bmHlChanged : 1;
uint16_t bmPgmString : 1;
};
 
class ScreenItem
{
ScreenItemAttributes itemAttribs;
void *dataItem;
void Print(Max_LCD *p);
void SetAttribs(uint8_t left, uint8_t top, uint8_t len, bool highlighted, bool pgm);
public:
ScreenItem(uint8_t left, uint8_t top, uint8_t len, bool highlighted, DataItemBase *item);
ScreenItem(uint8_t left, uint8_t top, uint8_t len, bool highlighted, const char *item);
void Update(Max_LCD *pLcd, bool initial = true);
void Highlight(bool on) { itemAttribs.bmHighlighted = (on) ? 1 : 0; itemAttribs.bmHlChanged = 1; };
bool IsHighlighted() { return (itemAttribs.bmHighlighted == 1); };
};
 
#endif
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSCapture/EOSCapture.pde
0,0 → 1,71
/* Capture command demo */
#include <inttypes.h>
#include <avr/pgmspace.h>
 
//#include <Spi.h>
#include <Max3421e.h>
#include <Max3421e_constants.h>
#include <Max_LCD.h>
#include <Usb.h>
 
#include <ptp.h>
#include <canoneos.h>
 
#include <MemoryFree.h>
 
#define DEV_ADDR 1
 
// Canon EOS 400D
#define DATA_IN_EP 1
#define DATA_OUT_EP 2
#define INTERRUPT_EP 3
#define CONFIG_NUM 1
 
class CamStateHandlers : public PTPStateHandlers
{
bool stateConnected;
public:
CamStateHandlers() : stateConnected(false) {};
virtual void OnDeviceDisconnectedState(PTP *ptp);
virtual void OnDeviceInitializedState(PTP *ptp);
} CamStates;
 
CanonEOS Eos(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);
 
void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
{
if (stateConnected)
{
stateConnected = false;
Notify(PSTR("Camera disconnected\r\n"));
}
}
 
void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
{
if (!stateConnected)
stateConnected = true;
 
uint16_t rc = Eos.Capture();
if (rc != PTP_RC_OK)
Message(PSTR("Error: "), rc);
delay(5000);
}
 
void setup()
{
Serial.begin( 115200 );
Serial.println("Start");
Eos.Setup();
delay( 200 );
}
 
void loop()
{
Eos.Task();
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSEventLab/EOSEventLab.pde
0,0 → 1,80
/* EOS event visualizer. Connect camera and start pressing some buttons - the events would be printed on the screen */
/* doesn't work very well with XSI */
#include <inttypes.h>
#include <avr/pgmspace.h>
 
//#include <Spi.h>
#include <Max3421e.h>
#include <Max3421e_constants.h>
#include <Max_LCD.h>
#include <Usb.h>
 
#include <ptp.h>
#include <canoneos.h>
#include <simpletimer.h>
 
#define DEV_ADDR 1
 
// Canon EOS 400D
#define DATA_IN_EP 1
#define DATA_OUT_EP 2
#define INTERRUPT_EP 3
#define CONFIG_NUM 1
 
class CamStateHandlers : public EOSStateHandlers
{
enum CamStates { stInitial, stDisconnected, stConnected };
CamStates stateConnected;
public:
CamStateHandlers() : stateConnected(stInitial) {};
virtual void OnDeviceDisconnectedState(PTP *ptp);
virtual void OnDeviceInitializedState(PTP *ptp);
};
 
CamStateHandlers CamStates;
SimpleTimer PTPPollTimer;
CanonEOS Eos(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);
 
 
void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
{
if (stateConnected == stConnected || stateConnected == stInitial)
{
stateConnected = stDisconnected;
PTPPollTimer.Disable();
Notify(PSTR("\r\nDevice disconnected.\r\n"));
}
}
 
void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
{
if (stateConnected == stDisconnected)
{
stateConnected = stConnected;
PTPPollTimer.Enable();
}
}
 
void OnPTPPollTimer()
{
EOSEventDump hex;
Eos.EventCheck(&hex);
}
 
void setup()
{
Serial.begin( 115200 );
Serial.println("Start");
Eos.Setup();
delay( 200 );
PTPPollTimer.Set(OnPTPPollTimer, 500);
}
 
void loop()
{
Eos.Task();
PTPPollTimer.Run();
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSEventMonitor/EOSEventMonitor.pde
0,0 → 1,83
#include <inttypes.h>
#include <avr/pgmspace.h>
 
//#include <Spi.h>
#include <Max3421e.h>
#include <Max3421e_constants.h>
#include <Max_LCD.h>
#include <Usb.h>
 
#include <ptp.h>
#include <ptpdebug.h>
#include <canoneos.h>
#include <simpletimer.h>
 
#define DEV_ADDR 1
 
// Canon EOS 400D
#define DATA_IN_EP 1
#define DATA_OUT_EP 2
#define INTERRUPT_EP 3
#define CONFIG_NUM 1
 
class CamStateHandlers : public EOSStateHandlers
{
enum CamStates { stInitial, stDisconnected, stConnected };
CamStates stateConnected;
public:
CamStateHandlers() : stateConnected(stInitial)
{
};
virtual void OnDeviceDisconnectedState(PTP *ptp);
virtual void OnDeviceInitializedState(PTP *ptp);
};
 
CamStateHandlers CamStates;
SimpleTimer PTPPollTimer;
CanonEOS Eos(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);
 
 
void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
{
if (stateConnected == stConnected || stateConnected == stInitial)
{
stateConnected = stDisconnected;
PTPPollTimer.Disable();
Notify(PSTR("\r\nDevice disconnected.\r\n"));
}
}
 
void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
{
if (stateConnected == stDisconnected)
{
stateConnected = stConnected;
PTPPollTimer.Enable();
}
}
 
void OnPTPPollTimer()
{
Serial.println("\r\n");
HexDump hex;
Eos.EventCheck(&hex);
}
 
void setup()
{
Serial.begin( 115200 );
Serial.println("Start");
Eos.Setup();
delay( 200 );
PTPPollTimer.Set(OnPTPPollTimer, 1000);
}
 
void loop()
{
Eos.Task();
PTPPollTimer.Run();
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSFocus/EOSFocus.pde
0,0 → 1,87
/* EOS Focus control demo */
/* Tested with 7D */
#include <inttypes.h>
#include <avr/pgmspace.h>
 
//#include <Spi.h>
#include <Max3421e.h>
#include <Max3421e_constants.h>
#include <Max_LCD.h>
#include <Usb.h>
 
#include <ptp.h>
#include <canoneos.h>
 
#define DEV_ADDR 1
 
// Canon EOS 400D
#define DATA_IN_EP 1
#define DATA_OUT_EP 2
#define INTERRUPT_EP 3
#define CONFIG_NUM 1
 
class CamStateHandlers : public EOSStateHandlers
{
enum CamStates { stInitial, stDisconnected, stConnected };
CamStates stateConnected;
public:
CamStateHandlers() : stateConnected(stInitial)
{
};
virtual void OnDeviceDisconnectedState(PTP *ptp);
virtual void OnDeviceInitializedState(PTP *ptp);
};
 
CamStateHandlers CamStates;
CanonEOS Eos(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);
 
void setup() {
Serial.begin( 115200 );
Serial.println("Start");
Eos.Setup();
delay( 200 );
}
 
void loop()
{
Eos.Task();
}
 
void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
{
if (stateConnected == stConnected || stateConnected == stInitial)
{
stateConnected = stDisconnected;
Notify(PSTR("Camera disconnected.\r\n"));
}
}
 
void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
{
if (stateConnected == stDisconnected)
{
stateConnected = stConnected;
 
// Switch LiveView on
Eos.SwitchLiveView(true);
delay(50);
for (uint8_t i=0; i<10; i++)
{
if (i > 4)
Eos.MoveFocus(3);
else
Eos.MoveFocus(0x8003);
 
delay(100);
Eos.Capture();
delay(1500);
}
 
// Switch LiveView off
Eos.SwitchLiveView(false);
}
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSHDRCapture/EOSHDRCapture.pde
0,0 → 1,114
/* Exposure compensation change demo */
#include <inttypes.h>
#include <avr/pgmspace.h>
 
//#include <Spi.h>
#include <Max3421e.h>
#include <Max3421e_constants.h>
#include <Max_LCD.h>
#include <Usb.h>
#include <ptp.h>
#include <canoneos.h>
#include <qep_port.h>
 
#include "hdrcapture.h"
 
#define DEV_ADDR 1
 
// Canon EOS 400D
#define DATA_IN_EP 1
#define DATA_OUT_EP 2
#define INTERRUPT_EP 3
#define CONFIG_NUM 1
 
class CamStateHandlers : public EOSStateHandlers
{
enum CamStates { stInitial, stDisconnected, stConnected };
CamStates stateConnected;
public:
CamStateHandlers() : stateConnected(stInitial)
{
};
virtual void OnDeviceDisconnectedState(PTP *ptp);
virtual void OnDeviceInitializedState(PTP *ptp);
};
 
CamStateHandlers CamStates;
CanonEOS Eos(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);
HDRCapture hdrCapture(Eos);
QEvent msTick;
QEvent secTick;
 
void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
{
if (stateConnected == stConnected || stateConnected == stInitial)
{
stateConnected = stDisconnected;
Notify(PSTR("Camera disconnected\r\n"));
}
}
 
void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
{
if (stateConnected == stDisconnected)
{
stateConnected = stConnected;
Serial.println("Connected");
 
SetEvt setEvt;
setEvt.sig = RUN_SIG;
hdrCapture.PostEvent(&setEvt);
}
hdrCapture.Run();
hdrCapture.PostEvent(&msTick); // post TICK_MILLIS_SIG event
}
 
void setup()
{
Serial.begin( 115200 );
Serial.println("Start");
 
Eos.Setup();
delay( 200 );
 
hdrCapture.init();
SetEvt setEvt;
setEvt.sig = SET_FRAMES_SIG;
setEvt.value = 3;
hdrCapture.dispatch(&setEvt);
setEvt.sig = SET_FRAME_TIMEOUT_SIG;
setEvt.value = 5;
hdrCapture.dispatch(&setEvt);
setEvt.sig = SET_SELF_TIMEOUT_SIG;
setEvt.value = 3;
hdrCapture.dispatch(&setEvt);
SetBktEvt setBktEvt;
setBktEvt.sig = SET_BRACKETING_SIG;
setBktEvt.step = 2;
setBktEvt.negative = 3;
setBktEvt.positive = 9;
hdrCapture.dispatch(&setBktEvt);
msTick.sig = TICK_MILLIS_SIG;
}
 
void loop()
{
Eos.Task();
delay(1);
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSHDRCapture/expcomp_macro.h
0,0 → 1,9
#if !defined(__EXPCOMP_MACRO_H__)
#define __EXPCOMP_MACRO_H__
 
uint8_t expComp[] = { 0xF0, 0xF3, 0xF5, 0xF8, 0xFB, 0xFD, 0, 0x03, 0x05, 0x08, 0x0B, 0x0D, 0x10 };
 
 
#define EXP_COMP_VALUE(i)((uint32_t)expComp[(i)])
 
#endif // __EXPCOMP_MACRO_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSHDRCapture/hdrcapture.cpp
0,0 → 1,336
#include "hdrcapture.h"
#include "expcomp_macro.h"
 
/* fixes avr-gcc incompatibility with virtual destructors */
void operator delete( void *p ) {}
 
QState HDRCapture::Initial(HDRCapture *me, QEvent const *e)
{
return Q_TRAN(&HDRCapture::Inactive);
}
 
QState HDRCapture::Inactive(HDRCapture *me, QEvent const *e)
{
switch(e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("Inactive\r\n");
return Q_HANDLED();
case SET_FRAMES_SIG:
me->frmCount = (uint16_t)((SetEvt*)e)->value;
return Q_HANDLED();
case SET_SELF_TIMEOUT_SIG:
me->selfTimeout = ((SetEvt*)e)->value;
return Q_HANDLED();
case SET_FRAME_TIMEOUT_SIG:
me->frameTimeout = ((SetEvt*)e)->value;
return Q_HANDLED();
case SET_BRACKETING_SIG:
me->bktStep = ((SetBktEvt*)e)->step;
me->bktNegative = ((SetBktEvt*)e)->negative;
me->bktPositive = ((SetBktEvt*)e)->positive;
return Q_HANDLED();
case RUN_SIG:
me->frmCntdn = me->frmCount;
me->bktCntdn = (me->bktStep) ? (me->bktPositive - me->bktNegative) / me->bktStep + 1 : 1;
me->bktPos = me->bktNegative;
return Q_TRAN(&HDRCapture::Active);
}
return Q_SUPER(&QHsm::top);
}
 
QState HDRCapture::Active(HDRCapture *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("Active\r\n");
return Q_HANDLED();
case Q_EXIT_SIG:
PTPTRACE("::Q_EXIT_SIG\r\n");
return Q_HANDLED();
case Q_INIT_SIG:
PTPTRACE("Q_INIT_SIG\r\n");
return Q_TRAN(&HDRCapture::SaveSettings);
case RUN_SIG:
PTPTRACE("::RUN_SIG\r\n");
return Q_TRAN(&HDRCapture::SaveSettings);
case ABORT_SIG:
PTPTRACE("ABORT_SIG\r\n");
return Q_TRAN(&HDRCapture::RestoreSettings);
case PTP_RC_SIG:
PTPTRACE("::PTP_RC_SIG\r\n");
switch (((PTP_RC_Evt*)e)->rc)
{
case PTP_RC_OK:
me->qpEvt.sig = PTP_RC_OK_SIG;
me->theQueue.Push(&me->qpEvt);
return Q_HANDLED();
case PTP_RC_DeviceBusy:
me->toEvt.timeout = PTP_TIMEOUT;
me->toEvt.attribs = TA_PTP_TIMEOUT;
me->theQueue.Push(&me->toEvt);
return Q_TRAN(&HDRCapture::Timeout);
default:
return Q_TRAN(&HDRCapture::Inactive);
}
case SET_TIMEOUT_SIG:
PTPTRACE("::SET_TIMEOUT_SIG\r\n");
return Q_HANDLED();
case TIMEOUT_SIG:
PTPTRACE("::TIMEOUT_SIG\r\n");
return Q_TRAN(me->activeHistory);
case PTP_RC_OK_SIG:
PTPTRACE("::PTP_RC_OK_SIG\r\n");
return Q_TRAN(me->activeHistory);
case TICK_MILLIS_SIG:
PTPTRACE("::TICK_MILLIS_SIG\r\n");
return Q_HANDLED();
}
return Q_SUPER(&QHsm::top);
}
 
QState HDRCapture::SaveSettings(HDRCapture *me, QEvent const *e)
{
static bool bSaved = false;
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("SaveSettings\r\n");
me->activeHistory = (QStateHandler)&SaveSettings;
// me->rcEvt.rc = me->Eos.GetProperty(EOS_DPC_ExposureCompensation, me->bktOldVal);
me->rcEvt.rc = PTP_RC_OK;
me->theQueue.Push(&me->rcEvt);
me->bktOldVal = (uint8_t)0;
return Q_HANDLED();
case PTP_RC_OK_SIG:
PTPTRACE("PTP_RC_OK_SIG\r\n");
if (me->selfTimeout)
{
me->theQueue.Push((QEvent*)e);
return Q_TRAN(&HDRCapture::SelfTimer);
}
return Q_TRAN(&HDRCapture::PreCapture);
} // switch
return Q_SUPER(&HDRCapture::Active);
}
 
QState HDRCapture::SelfTimer(HDRCapture *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("SelfTimer\r\n");
me->activeHistory = (QStateHandler)&SelfTimer;
return Q_HANDLED();
case TICK_MILLIS_SIG:
PTPTRACE("TICK_MILLIS_SIG\r\n");
return Q_TRAN(&HDRCapture::PreCapture);
case PTP_RC_OK_SIG:
PTPTRACE("PTP_RC_OK_SIG\r\n");
me->toEvt.timeout = me->selfTimeout;
me->toEvt.attribs = TA_SELF_TIMER;
me->theQueue.Push(&me->toEvt);
return Q_TRAN(&HDRCapture::Timeout);
case TIMEOUT_SIG:
PTPTRACE("TIMEOUT_SIG\r\n");
return Q_TRAN(&HDRCapture::PreCapture);
} // switch
return Q_SUPER(&HDRCapture::Active);
}
 
QState HDRCapture::RestoreSettings(HDRCapture *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("RestoreSettings\r\n");
me->activeHistory = (QStateHandler)&RestoreSettings;
me->rcEvt.rc = me->Eos.SetProperty(EOS_DPC_ExposureCompensation, me->bktOldVal);
me->theQueue.Push(&me->rcEvt);
return Q_HANDLED();
case PTP_RC_OK_SIG:
return Q_TRAN(&HDRCapture::Inactive);
} // switch
return Q_SUPER(&HDRCapture::Active);
}
 
QState HDRCapture::PreCapture(HDRCapture *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("PreCapture\r\n");
me->activeHistory = (QStateHandler)&PreCapture;
return Q_HANDLED();
case TICK_MILLIS_SIG:
PTPTRACE("TICK_MILLIS_SIG\r\n");
if (!me->bktCntdn)
{
me->bktCntdn = (me->bktStep) ? (me->bktPositive - me->bktNegative) / me->bktStep + 1 : 1;
me->bktPos = me->bktNegative;
}
if (me->bktStep)
return Q_TRAN(&HDRCapture::ExpCompSet);
return Q_TRAN(&HDRCapture::Capture);
} // switch
return Q_SUPER(&HDRCapture::Active);
}
 
QState HDRCapture::Capture(HDRCapture *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("Capture\r\n");
me->activeHistory = (QStateHandler)&Capture;
me->rcEvt.rc = me->Eos.Capture();
// me->rcEvt.rc = PTP_RC_OK;
me->theQueue.Push(&me->rcEvt);
return Q_HANDLED();
case PTP_RC_OK_SIG:
PTPTRACE("PTP_RC_OK_SIG\r\n");
return Q_TRAN(&HDRCapture::PostCapture);
} // switch
return Q_SUPER(&HDRCapture::Active);
}
 
QState HDRCapture::PostCapture(HDRCapture *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("PostCapture\r\n");
me->activeHistory = (QStateHandler)&PostCapture;
return Q_HANDLED();
case TICK_MILLIS_SIG:
PTPTRACE("TICK_MILLIS_SIG\r\n");
 
if (!me->bktCntdn)
return Q_TRAN(&HDRCapture::PreCapture);
 
me->bktPos += me->bktStep;
if (--me->bktCntdn == 0)
{
--me->frmCntdn;
me->OnFrameCaptured(me->frmCntdn);
}
me->OnBktFrameCaptured(me->bktCntdn);
 
// if it was the last frame in total
if (!me->frmCntdn)
{
me->qpEvt.sig = ABORT_SIG;
me->theQueue.Push(&me->qpEvt);
return Q_HANDLED();
}
if (me->bktCntdn)
return Q_TRAN(&HDRCapture::PreCapture);
 
// if it was the last frame in bracketing
me->toEvt.timeout = me->frameTimeout;
me->toEvt.attribs = TA_INTR_TIMER;
me->theQueue.Push(&me->toEvt);
return Q_TRAN(&HDRCapture::Timeout);
case TIMEOUT_SIG:
PTPTRACE("TIMEOUT_SIG\r\n");
return Q_TRAN(&HDRCapture::PreCapture);
}
return Q_SUPER(&HDRCapture::Active);
}
 
QState HDRCapture::ExpCompSet(HDRCapture *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("ExpCompSet\r\n");
me->activeHistory = (QStateHandler)&ExpCompSet;
me->rcEvt.rc = me->Eos.SetProperty(EOS_DPC_ExposureCompensation, EXP_COMP_VALUE(me->bktPos));
// me->rcEvt.rc = PTP_RC_OK;
me->theQueue.Push(&me->rcEvt);
return Q_HANDLED();
case PTP_RC_OK_SIG:
PTPTRACE("PTP_RC_OK_SIG\r\n");
return Q_TRAN(&HDRCapture::Capture);
} // switch
return Q_SUPER(&HDRCapture::Active);
}
 
QState HDRCapture::Timeout(HDRCapture *me, QEvent const *e)
{
static uint32_t timeout = 0;
static uint32_t local_time = 0;
static uint32_t seconds_left = 0;
static uint8_t attribs = 0;
static uint16_t sec_cntdn = 1000;
switch (e->sig)
{
case Q_ENTRY_SIG:
PTPTRACE("Timeout\r\n");
return Q_HANDLED();
case SET_TIMEOUT_SIG:
attribs = ((SetTimeoutEvt*)e)->attribs;
timeout = (attribs & 0x01) ? ((SetTimeoutEvt*)e)->timeout * 1000 : ((SetTimeoutEvt*)e)->timeout;
if (attribs & 0x01)
{
seconds_left = ((SetTimeoutEvt*)e)->timeout;
sec_cntdn = 1000;
switch (attribs)
{
case TA_SELF_TIMER:
me->OnSelfTimerProgress(seconds_left);
break;
case TA_INTR_TIMER:
me->OnIntrTimerProgress(seconds_left);
break;
// case TA_BULB_TIMER:
// me->OnBulbTimerProgress(seconds_left);
// break;
} // switch
}
local_time = millis();
return Q_HANDLED();
case TICK_MILLIS_SIG:
uint32_t dt = local_time;
local_time = millis();
dt = local_time - dt;
timeout = (timeout < dt) ? 0 : timeout - dt;
 
if (attribs & 1)
{
bool bTick = (sec_cntdn <= dt);
sec_cntdn = (sec_cntdn > dt) ? sec_cntdn - dt : 1000 - dt;
if (bTick)
{
seconds_left --;
switch (attribs)
{
case TA_SELF_TIMER:
me->OnSelfTimerProgress(seconds_left);
break;
case TA_INTR_TIMER:
me->OnIntrTimerProgress(seconds_left);
break;
} // switch
} // if (--sec_cntdn == 0)
} // if (attribs & 1)
if (!timeout)
{
me->qpEvt.sig = TIMEOUT_SIG;
me->theQueue.Push(&me->qpEvt);
}
return Q_HANDLED();
} // switch
return Q_SUPER(&HDRCapture::Active);
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSHDRCapture/hdrcapture.h
0,0 → 1,130
#if !defined(__HDRCAPTURE_H__)
#define __HDRCAPTURE_H__
 
#include <inttypes.h>
#include <avr/pgmspace.h>
#include <qep_port.h>
#include <ptp.h>
#include <canoneos.h>
#include <simplefifo.h>
#include <valuelist.h>
 
#define PTP_TIMEOUT 250
 
#define TA_PTP_TIMEOUT 0x00
#define TA_SELF_TIMER 0x03
#define TA_INTR_TIMER 0x05
#define TA_BULB_TIMER 0x07
 
enum HDRCaptureSignals
{
TICK_MILLIS_SIG = Q_USER_SIG,
SET_FRAMES_SIG,
SET_SELF_TIMEOUT_SIG,
SET_FRAME_TIMEOUT_SIG,
SET_BRACKETING_SIG,
RUN_SIG,
ABORT_SIG,
TIMEOUT_SIG,
SET_TIMEOUT_SIG,
PTP_RC_SIG,
PTP_RC_OK_SIG
};
 
struct SetTimeoutEvt : public QEvent
{
uint32_t timeout;
uint8_t attribs;
};
 
struct SetEvt : public QEvent
{
uint32_t value;
};
 
struct SetBktEvt : public QEvent
{
uint8_t step;
uint8_t negative;
uint8_t positive;
};
 
struct PTP_RC_Evt : public QEvent
{
uint16_t rc;
};
 
class HDRCapture : public QHsm
{
uint16_t frmCntdn;
uint16_t frmCount;
uint32_t selfTimeout;
uint32_t frameTimeout;
uint8_t bktStep;
uint8_t bktNegative;
uint8_t bktPositive;
uint8_t bktCntdn;
uint8_t bktPos;
uint8_t bktOldVal;
CanonEOS &Eos;
SetTimeoutEvt toEvt;
PTP_RC_Evt rcEvt;
QEvent qpEvt;
QStateHandler activeHistory;
 
SimpleFIFO<QEvent*, 4> theQueue;
public:
HDRCapture(CanonEOS &eos) :
QHsm((QStateHandler)&HDRCapture::Initial),
frmCount(0),
frmCntdn(0),
selfTimeout(0),
frameTimeout(0),
bktStep(0),
bktNegative(0),
bktPositive(0),
bktCntdn(0),
bktPos(0),
bktOldVal(0),
Eos(eos),
activeHistory(NULL)
{
toEvt.sig = SET_TIMEOUT_SIG;
rcEvt.sig = PTP_RC_SIG;
};
void PostEvent(QEvent *e)
{
theQueue.Push(e);
};
void Run()
{
QEvent *e = NULL;
while ( (e = theQueue.Pop()) )
dispatch(e);
};
 
protected:
static QState Initial(HDRCapture *me, QEvent const *e);
static QState Inactive(HDRCapture *me, QEvent const *e);
static QState Active(HDRCapture *me, QEvent const *e);
static QState SelfTimer(HDRCapture *me, QEvent const *e);
static QState PreCapture(HDRCapture *me, QEvent const *e);
static QState Capture(HDRCapture *me, QEvent const *e);
static QState PostCapture(HDRCapture *me, QEvent const *e);
static QState ExpCompSet(HDRCapture *me, QEvent const *e);
static QState SaveSettings(HDRCapture *me, QEvent const *e);
static QState RestoreSettings(HDRCapture *me, QEvent const *e);
static QState Timeout(HDRCapture *me, QEvent const *e);
virtual void OnFrameCaptured(uint16_t left) {};
virtual void OnBktFrameCaptured(uint16_t left) {};
virtual void OnSelfTimerProgress(uint32_t left) {};
virtual void OnIntrTimerProgress(uint32_t left) {};
};
 
#endif // __HDRCAPTURE_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSRemote/EOSConsole.cpp
0,0 → 1,428
#include "eosconsole.h"
#include <eosvaluetitles.h>
#include <valuelist.h>
 
extern CanonEOS Eos;
extern EEPROMByteList vlAperture;
extern EEPROMByteList vlShutterSpeed;
extern EEPROMByteList vlWhiteBalance;
extern EEPROMByteList vlPictureStyle;
extern EEPROMByteList vlIso;
extern EEPROMByteList vlExpCompensation;
 
extern uint8_t dpMode;
extern uint8_t dpAperture;
extern uint8_t dpShutterSpeed;
extern uint8_t dpWb;
extern uint8_t dpPStyle;
extern uint8_t dpIso;
extern uint8_t dpExpComp;
 
/* fixes avr-gcc incompatibility with virtual destructors */
void operator delete( void *p ) {}
 
const char* menuMain[] = {"Capture", "View Settings", "Change Settings"};
const char* menuChangeSettings[] = {"Aperture", "Shutter Speed", "WB", "Pict Style", "ISO", "Exp Comp"};
const char* menuUpDown[] = {"<<", ">>"};
 
void EOSConsole::ShowParams()
{
Notify(PSTR("\r\nMode:"));
Notify((char*)FindTitle<VT_MODE, VT_MODE_TEXT_LEN>(VT_MODE_COUNT, ModeTitles, dpMode));
Notify(PSTR("\r\nF:"));
Notify((char*)FindTitle<VT_APERTURE, VT_APT_TEXT_LEN>(VT_APT_COUNT, ApertureTitles, dpAperture));
Notify(PSTR("\r\nT:"));
Notify((char*)FindTitle<VT_SHSPEED, VT_SHSPEED_TEXT_LEN>(VT_SHSPEED_COUNT, ShutterSpeedTitles, dpShutterSpeed));
Notify(PSTR("\r\nWB:"));
Notify((char*)FindTitle<VT_WB, VT_WB_TEXT_LEN>(VT_WB_COUNT, WbTitles, dpWb));
Notify(PSTR("\r\nPict Style:"));
Notify((char*)FindTitle<VT_PSTYLE, VT_PSTYLE_TEXT_LEN>(VT_PSTYLE_COUNT, PStyleTitles, dpPStyle));
Notify(PSTR("\r\nISO:"));
Notify((char*)FindTitle<VT_ISO, VT_ISO_TEXT_LEN>(VT_ISO_COUNT, IsoTitles, dpIso));
Notify(PSTR("\r\nExp Comp:"));
Notify((char*)FindTitle<VT_EXPCOMP, VT_EXPCOMP_TEXT_LEN>(VT_EXPCOMP_COUNT, ExpCompTitles, dpExpComp));
Notify(PSTR("\r\n"));
}
 
QState EOSConsole::Initial(EOSConsole *me, QEvent const *e)
{
return Q_TRAN(&EOSConsole::Inactive);
}
 
QState EOSConsole::Inactive(EOSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case TICK_SIG:
return Q_TRAN(&EOSConsole::Active);
}
return Q_SUPER(QHsm::top);
}
 
QState EOSConsole::Active(EOSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_INIT_SIG:
return Q_TRAN(&EOSConsole::MainMenu);
case TICK_SIG:
return Q_TRAN(&EOSConsole::Inactive);
}
return Q_SUPER(QHsm::top);
}
 
void EOSConsole::PrintMenuTitles(uint8_t count, const char **menu)
{
Serial.println("");
for (uint8_t i=0; i<=count; i++)
{
Serial.print(i, DEC);
Serial.print(". ");
if (i == 0)
Serial.println("<..>");
else
Serial.println(menu[i-1]);
}
Serial.println("");
}
 
QState EOSConsole::MainMenu(EOSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(3, menuMain);
return Q_HANDLED();
case MENU_SELECT_SIG:
{
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
PrintMenuTitles(3, menuMain);
return Q_HANDLED();
case 1:
Eos.Capture();
return Q_HANDLED();
case 2:
ShowParams();
PrintMenuTitles(3, menuMain);
return Q_HANDLED();
case 3:
return Q_TRAN(&EOSConsole::ChangeSettingsMenu);
}
}
}
return Q_SUPER(&EOSConsole::Active);
}
 
QState EOSConsole::ChangeSettingsMenu(EOSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(6, menuChangeSettings);
return Q_HANDLED();
case MENU_SELECT_SIG:
{
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&EOSConsole::MainMenu);
case 1: // Aperture
return Q_TRAN(&EOSConsole::ChangeApertureMenu);
case 2: // Shutter Speed
return Q_TRAN(&EOSConsole::ChangeShutterSpeedMenu);
case 3: // White Balance
return Q_TRAN(&EOSConsole::ChangeWBMenu);
case 4: // Picture Style
return Q_TRAN(&EOSConsole::ChangePStyleMenu);
case 5: // ISO
return Q_TRAN(&EOSConsole::ChangeIsoMenu);
case 6: // Exposure Compensation
return Q_TRAN(&EOSConsole::ChangeExpCompMenu);
} // switch
}
}
return Q_SUPER(&EOSConsole::Active);
}
 
QState EOSConsole::ChangeApertureMenu(EOSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(2, menuUpDown);
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&EOSConsole::ChangeSettingsMenu);
case 2:
if (vlAperture.GetSize() > 0)
{
new_value = vlAperture.GetNext(dpAperture, 1);
Eos.SetProperty(EOS_DPC_Aperture, new_value);
}
return Q_HANDLED();
case 1:
if (vlAperture.GetSize() > 0)
{
new_value = vlAperture.GetPrev(dpAperture, 1);
Eos.SetProperty(EOS_DPC_Aperture, new_value);
}
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&EOSConsole::Active);
}
 
QState EOSConsole::ChangeShutterSpeedMenu(EOSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(2, menuUpDown);
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&EOSConsole::ChangeSettingsMenu);
case 2:
if (vlShutterSpeed.GetSize() > 0)
{
new_value = vlShutterSpeed.GetNext(dpShutterSpeed, 1);
Eos.SetProperty(EOS_DPC_ShutterSpeed, new_value);
}
return Q_HANDLED();
case 1:
if (vlShutterSpeed.GetSize() > 0)
{
new_value = vlShutterSpeed.GetPrev(dpShutterSpeed, 1);
Eos.SetProperty(EOS_DPC_ShutterSpeed, new_value);
}
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&EOSConsole::Active);
}
 
QState EOSConsole::ChangeWBMenu(EOSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(2, menuUpDown);
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&EOSConsole::ChangeSettingsMenu);
case 2:
if (vlWhiteBalance.GetSize() > 0)
{
new_value = vlWhiteBalance.GetNext(dpWb, 1);
Eos.SetProperty(EOS_DPC_WhiteBalance, new_value);
}
return Q_HANDLED();
case 1:
if (vlAperture.GetSize() > 0)
{
new_value = vlWhiteBalance.GetPrev(dpWb, 1);
Eos.SetProperty(EOS_DPC_WhiteBalance, new_value);
}
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&EOSConsole::Active);
}
 
QState EOSConsole::ChangeIsoMenu(EOSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(2, menuUpDown);
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&EOSConsole::ChangeSettingsMenu);
case 2:
if (vlIso.GetSize() > 0)
{
new_value = vlIso.GetNext(dpIso, 1);
Eos.SetProperty(EOS_DPC_Iso, new_value);
}
return Q_HANDLED();
case 1:
if (vlAperture.GetSize() > 0)
{
new_value = vlIso.GetPrev(dpIso, 1);
Eos.SetProperty(EOS_DPC_Iso, new_value);
}
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&EOSConsole::Active);
}
 
QState EOSConsole::ChangePStyleMenu(EOSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(2, menuUpDown);
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&EOSConsole::ChangeSettingsMenu);
case 2:
if (vlPictureStyle.GetSize() > 0)
{
new_value = vlPictureStyle.GetNext(dpPStyle, 1);
Eos.SetProperty(EOS_DPC_PictureStyle, new_value);
}
return Q_HANDLED();
case 1:
if (vlPictureStyle.GetSize() > 0)
{
new_value = vlPictureStyle.GetPrev(dpPStyle, 1);
Eos.SetProperty(EOS_DPC_PictureStyle, new_value);
}
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&EOSConsole::Active);
}
 
QState EOSConsole::ChangeExpCompMenu(EOSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(2, menuUpDown);
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&EOSConsole::ChangeSettingsMenu);
case 2:
if (vlExpCompensation.GetSize() > 0)
{
new_value = vlExpCompensation.GetNext(dpExpComp, 1);
Eos.SetProperty(EOS_DPC_ExposureCompensation, new_value);
}
return Q_HANDLED();
case 1:
if (vlExpCompensation.GetSize() > 0)
{
new_value = vlExpCompensation.GetPrev(dpExpComp, 1);
Eos.SetProperty(EOS_DPC_ExposureCompensation, new_value);
}
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&EOSConsole::Active);
}
 
//static EOSConsole menu;
static TickEvt tick_evt;
//static MenuSelectEvt menu_sel_evt;
 
//............................................................................
 
//void setup()
//{
// Serial.begin( 115200 );
//
// menu.init(); // take the initial transition
//
// tick_evt.sig = TICK_SIG;
// tick_evt.fine_time = 0;
//}
 
int8_t EOSConsole::MenuSelect()
{
if( !Serial.available())
return -1;
uint8_t char_count = 0;
uint8_t index = 0;
while (Serial.available() > 0 && char_count < 2)
{
uint8_t key = Serial.read();
key -= '0';
if (index)
{
uint8_t tmp = index;
// index *= 10;
index <<= 3;
index += tmp;
index += tmp;
}
index += key;
char_count ++;
}
return (char_count) ? (int8_t)index : (int8_t)-1;
}
 
//void loop()
//{
// delay(100); // 100 ms delay
//
// if (++tick_evt.fine_time == 10)
// tick_evt.fine_time = 0;
//
// menu.dispatch(&tick_evt); // dispatch TICK event
//
// int8_t index = MenuSelect();
//
// if (index >= 0)
// {
// menu_sel_evt.sig = MENU_SELECT_SIG;
// menu_sel_evt.item_index = index;
// menu.dispatch(&menu_sel_evt); // dispatch the event
// }
//}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSRemote/EOSConsole.h
0,0 → 1,51
#if !defined(__EOSCONSOLE_H__)
#define __EOSCONSOLE_H__
 
#include <inttypes.h>
#include <avr/pgmspace.h>
#include <qep_port.h>
#include <WProgram.h>
#include <canoneos.h>
 
enum TextMenuSignals
{
MENU_SELECT_SIG = Q_USER_SIG,
TICK_SIG
};
 
struct TickEvt : public QEvent
{
uint8_t fine_time; // the fine 1/10 s counter
};
 
struct MenuSelectEvt : public QEvent
{
uint8_t item_index;
};
 
class EOSConsole : public QHsm
{
static void PrintMenuTitles(uint8_t count, const char **menu);
static void ShowParams();
public:
EOSConsole()
: QHsm((QStateHandler)&EOSConsole::Initial)
{};
int8_t MenuSelect();
 
protected:
static QState Initial(EOSConsole *me, QEvent const *e);
static QState Inactive(EOSConsole *me, QEvent const *e);
static QState Active(EOSConsole *me, QEvent const *e);
static QState MainMenu(EOSConsole *me, QEvent const *e);
static QState ChangeSettingsMenu(EOSConsole *me, QEvent const *e);
static QState ChangeApertureMenu(EOSConsole *me, QEvent const *e);
static QState ChangeShutterSpeedMenu(EOSConsole *me, QEvent const *e);
static QState ChangeWBMenu(EOSConsole *me, QEvent const *e);
static QState ChangePStyleMenu(EOSConsole *me, QEvent const *e);
static QState ChangeExpCompMenu(EOSConsole *me, QEvent const *e);
static QState ChangeIsoMenu(EOSConsole *me, QEvent const *e);
};
 
#endif // __EOSCONSOLE_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSRemote/EOSRemote.pde
0,0 → 1,147
/* EOS control terminal */
//#include <Spi.h>
#include <Max3421e.h>
#include <Usb.h>
#include <simpletimer.h>
#include <ptp.h>
#include <canoneos.h>
#include <qep_port.h>
#include <valuelist.h>
#include <eosvaluetitles.h>
 
#include "eoseventparser.h"
#include "eosconsole.h"
 
#define DEV_ADDR 1
 
// Canon EOS 400D
#define DATA_IN_EP 1
#define DATA_OUT_EP 2
#define INTERRUPT_EP 3
#define CONFIG_NUM 1
 
#define EEP_APERTURE_LIST_OFFSET 0
#define EEP_APERTURE_LIST_SIZE 32
 
#define EEP_SHTSPEED_LIST_OFFSET (EEP_APERTURE_LIST_OFFSET + EEP_APERTURE_LIST_SIZE)
#define EEP_SHTSPEED_LIST_SIZE 64
 
#define EEP_WBALANCE_LIST_OFFSET (EEP_SHTSPEED_LIST_OFFSET + EEP_SHTSPEED_LIST_SIZE)
#define EEP_WBALANCE_LIST_SIZE 12
 
#define EEP_PICSTYLE_LIST_OFFSET (EEP_WBALANCE_LIST_OFFSET + EEP_WBALANCE_LIST_SIZE)
#define EEP_PICSTYLE_LIST_SIZE 12
 
#define EEP_EXPOCOR_LIST_OFFSET (EEP_PICSTYLE_LIST_OFFSET + EEP_PICSTYLE_LIST_SIZE)
#define EEP_EXPOCOR_LIST_SIZE 48
 
#define EEP_ISO_LIST_OFFSET (EEP_EXPOCOR_LIST_OFFSET + EEP_EXPOCOR_LIST_SIZE)
#define EEP_ISO_LIST_SIZE 8
 
EEPROMByteList vlAperture(EEP_APERTURE_LIST_OFFSET, EEP_APERTURE_LIST_SIZE);
EEPROMByteList vlShutterSpeed(EEP_SHTSPEED_LIST_OFFSET, EEP_SHTSPEED_LIST_SIZE);
EEPROMByteList vlWhiteBalance(EEP_WBALANCE_LIST_OFFSET, EEP_WBALANCE_LIST_SIZE);
EEPROMByteList vlPictureStyle(EEP_PICSTYLE_LIST_OFFSET, EEP_PICSTYLE_LIST_SIZE);
EEPROMByteList vlIso(EEP_EXPOCOR_LIST_OFFSET, EEP_EXPOCOR_LIST_SIZE);
EEPROMByteList vlExpCompensation(EEP_EXPOCOR_LIST_OFFSET, EEP_EXPOCOR_LIST_SIZE);
 
class CamStateHandlers : public EOSStateHandlers
{
enum CamStates { stInitial, stDisconnected, stConnected };
CamStates stateConnected;
public:
CamStateHandlers() : stateConnected(stInitial)
{
};
virtual void OnDeviceDisconnectedState(PTP *ptp);
virtual void OnDeviceInitializedState(PTP *ptp);
};
 
CamStateHandlers CamStates;
SimpleTimer ControlTimer, PTPPollTimer;
 
CanonEOS Eos(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);
QEvent evtTick, evtAbort;
EOSConsole eosConsole;
 
uint8_t dpMode = 0;
uint8_t dpAperture = 0;
uint8_t dpShutterSpeed = 0;
uint8_t dpWb = 0;
uint8_t dpPStyle = 0;
uint8_t dpIso = 0;
uint8_t dpExpComp = 0;
 
void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
{
if (stateConnected == stConnected || stateConnected == stInitial)
{
stateConnected = stDisconnected;
PTPPollTimer.Disable();
Notify(PSTR("Camera disconnected.\r\n"));
if (stateConnected == stConnected)
eosConsole.dispatch(&evtTick);
}
}
 
void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
{
if (stateConnected == stDisconnected)
{
stateConnected = stConnected;
PTPPollTimer.Enable();
eosConsole.dispatch(&evtTick);
}
int8_t index = eosConsole.MenuSelect();
if (index >= 0)
{
MenuSelectEvt menu_sel_evt;
menu_sel_evt.sig = MENU_SELECT_SIG;
menu_sel_evt.item_index = index;
eosConsole.dispatch(&menu_sel_evt); // dispatch the event
}
}
 
void OnControlTimer()
{
// ExtControls.CheckControls();
// hdrCapture.PostEvent(&evtTick);
// Screen::Run(&LCD);
}
 
void OnPTPPollTimer()
{
EOSEventParser prs;
Eos.EventCheck(&prs);
}
 
void setup()
{
Serial.begin(115200);
Eos.Setup();
delay( 200 );
PTPPollTimer.Set(OnPTPPollTimer, 300);
// 1ms is the perfect interval for encoder polling
ControlTimer.Set(OnControlTimer, 1);
ControlTimer.Enable();
evtTick.sig = TICK_SIG;
// evtAbort.sig = ABORT_SIG;
eosConsole.init();
 
Serial.println("Start");
}
 
void loop()
{
Eos.Task();
PTPPollTimer.Run();
ControlTimer.Run();
}
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSRemote/eoseventparser.cpp
0,0 → 1,212
#include "eoseventparser.h"
#include <eosvaluetitles.h>
 
extern EEPROMByteList vlAperture;
extern EEPROMByteList vlShutterSpeed;
extern EEPROMByteList vlWhiteBalance;
extern EEPROMByteList vlPictureStyle;
extern EEPROMByteList vlExpCompensation;
extern EEPROMByteList vlIso;
 
extern uint8_t dpMode;
extern uint8_t dpAperture;
extern uint8_t dpShutterSpeed;
extern uint8_t dpWb;
extern uint8_t dpPStyle;
extern uint8_t dpIso;
extern uint8_t dpExpComp;
 
 
bool EOSEventParser::EventRecordParse(uint8_t **pp, uint16_t *pcntdn)
{
switch (nRecStage)
{
case 0:
// Retrieves the size of the event record
if (!valueParser.Parse(pp, pcntdn))
return false;
 
nRecSize = (uint16_t)varBuffer;
 
// calculates the number of event parameters ( size / 4 - 1 )
paramCountdown = (nRecSize >> 2) - 1;
paramCount = 1;
nRecSize -= 4;
nRecStage ++;
case 1:
for (; paramCountdown; paramCountdown--, paramCount++, nRecSize -= 4)
{
if (!valueParser.Parse(pp, pcntdn))
return false;
 
switch (paramCount)
{
// Event Code
case 1:
eosEvent.eventCode = (uint16_t)varBuffer;
break;
// Property Code
case 2:
// if (eosEvent.eventCode == EOS_EC_ObjectCreated)
// {
// }
eosEvent.propCode = (uint16_t)varBuffer;
break;
// C189 - Property Value, C18A - Enumerator Type
case 3:
eosEvent.propValue = varBuffer;
if (eosEvent.eventCode == EOS_EC_DevPropChanged)
{
switch (eosEvent.propCode)
{
case EOS_DPC_Aperture:
dpAperture = (uint8_t) varBuffer;
Notify(PSTR("F:"));
Notify((char*)FindTitle<VT_APERTURE, VT_APT_TEXT_LEN>(VT_APT_COUNT, ApertureTitles, dpAperture));
Notify(PSTR("\r\n"));
break;
case EOS_DPC_ShutterSpeed:
dpShutterSpeed = (uint8_t) varBuffer;
Notify(PSTR("T:"));
Notify((char*)FindTitle<VT_SHSPEED, VT_SHSPEED_TEXT_LEN>(VT_SHSPEED_COUNT, ShutterSpeedTitles, dpShutterSpeed));
Notify(PSTR("\r\n"));
break;
case EOS_DPC_ShootingMode:
dpMode = (uint8_t) varBuffer;
Notify(PSTR("Mode:"));
Notify((char*)FindTitle<VT_MODE, VT_MODE_TEXT_LEN>(VT_MODE_COUNT, ModeTitles, dpMode));
Notify(PSTR("\r\n"));
break;
case EOS_DPC_WhiteBalance:
dpWb = (uint8_t) varBuffer;
Notify(PSTR("WB:"));
Notify((char*)FindTitle<VT_WB, VT_WB_TEXT_LEN>(VT_WB_COUNT, WbTitles, dpWb));
Notify(PSTR("\r\n"));
break;
case EOS_DPC_PictureStyle:
dpPStyle = (uint8_t) varBuffer;
Notify(PSTR("Pict Style:"));
Notify((char*)FindTitle<VT_PSTYLE, VT_PSTYLE_TEXT_LEN>(VT_PSTYLE_COUNT, PStyleTitles, dpPStyle));
Notify(PSTR("\r\n"));
break;
case EOS_DPC_Iso:
dpIso = (uint8_t) varBuffer;
Notify(PSTR("ISO:"));
Notify((char*)FindTitle<VT_ISO, VT_ISO_TEXT_LEN>(VT_ISO_COUNT, IsoTitles, dpIso));
Notify(PSTR("\r\n"));
break;
case EOS_DPC_ExposureCompensation:
dpExpComp = (uint8_t) varBuffer;
Notify(PSTR("Exp Comp:"));
Notify((char*)FindTitle<VT_EXPCOMP, VT_EXPCOMP_TEXT_LEN>(VT_EXPCOMP_COUNT, ExpCompTitles, dpExpComp));
Notify(PSTR("\r\n"));
break;
};
}
break;
// C18A/enumType == 3 - Size of enumerator array
case 4:
if (eosEvent.eventCode == EOS_EC_DevPropValuesAccepted)
{
switch (eosEvent.propCode)
{
case EOS_DPC_Aperture:
vlAperture.SetSize((uint8_t)varBuffer);
break;
case EOS_DPC_ShutterSpeed:
vlShutterSpeed.SetSize((uint8_t)varBuffer);
break;
case EOS_DPC_WhiteBalance:
vlWhiteBalance.SetSize((uint8_t)varBuffer);
break;
case EOS_DPC_PictureStyle:
vlPictureStyle.SetSize((uint8_t)varBuffer);
break;
case EOS_DPC_Iso:
vlIso.SetSize((uint8_t)varBuffer);
break;
case EOS_DPC_ExposureCompensation:
vlExpCompensation.SetSize((uint8_t)varBuffer);
break;
};
}
break;
// C18A/enumType == 3 - Enumerator Values
default:
if (eosEvent.eventCode == EOS_EC_DevPropValuesAccepted)
{
switch (eosEvent.propCode)
{
case EOS_DPC_Aperture:
vlAperture.Set(paramCount-5, (uint8_t)varBuffer);
break;
case EOS_DPC_ShutterSpeed:
vlShutterSpeed.Set(paramCount-5, (uint8_t)varBuffer);
break;
case EOS_DPC_WhiteBalance:
vlWhiteBalance.Set(paramCount-5, (uint8_t)varBuffer);
break;
case EOS_DPC_PictureStyle:
vlPictureStyle.Set(paramCount-5, (uint8_t)varBuffer);
break;
case EOS_DPC_ExposureCompensation:
vlExpCompensation.Set(paramCount-5, (uint8_t)varBuffer);
break;
case EOS_DPC_Iso:
vlIso.Set(paramCount-5, (uint8_t)varBuffer);
break;
} // switch (eosEvent.propCode)
}
} // switch (paramCount)
} // for
nRecStage ++;
case 2:
if (nRecSize)
if (!byteSkipper.Skip(pp, pcntdn, nRecSize))
return false;
 
nRecSize = 0;
nRecStage = 0;
}
return true;
}
 
void EOSEventParser::InitEOSEventStruct()
{
eosEvent.eventCode = constInitialEventCode;
eosEvent.propCode = 0;
eosEvent.propValue = 0;
}
 
 
void EOSEventParser::Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset)
{
uint8_t *p = (uint8_t*) pbuf;
uint16_t cntdn = len;
 
switch (nStage)
{
case 0:
p += 12;
cntdn -= 12;
nStage ++;
case 1:
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
InitEOSEventStruct();
nStage ++;
case 2:
while (1)
{
if (!EventRecordParse(&p, &cntdn))
return;
if (IsLastEventRecord())
break;
InitEOSEventStruct();
}
nStage = 0;
}
}
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSRemote/eoseventparser.h
0,0 → 1,74
#ifndef __EOSEVENTPARSER_H__
#define __EOSEVENTPARSER_H__
 
#include <inttypes.h>
#include <avr/pgmspace.h>
#include <ptpcallback.h>
#include <canoneos.h>
 
 
struct EOSParamValues
{
uint8_t upperValue;
uint8_t currentValue;
uint8_t lowerValue;
};
 
#define MAX_OBJ_IN_LIST 8
 
class EOSEventParser : public PTPReadParser
{
const uint16_t constInitialEventCode;
 
uint8_t paramsChanged;
 
struct EOSEvent
{
uint16_t eventCode;
uint16_t propCode;
uint32_t propValue;
};
 
uint8_t nStage;
uint8_t nRecStage;
uint16_t nRecSize;
MultiValueBuffer theBuffer;
uint32_t varBuffer;
EOSEvent eosEvent;
uint16_t paramCountdown;
uint16_t paramCount;
 
MultiByteValueParser valueParser;
ByteSkipper byteSkipper;
 
bool EventRecordParse(uint8_t **pp, uint16_t *pcntdn);
bool IsLastEventRecord() { return (eosEvent.eventCode == 0); };
void InitEOSEventStruct();
 
public:
EOSEventParser() :
constInitialEventCode(0xFFFF),
nStage(0),
nRecStage(0),
nRecSize(0),
varBuffer(0),
paramCountdown(0),
paramsChanged(0)
{
theBuffer.pValue = &varBuffer;
};
 
void Reset()
{
nStage = 0;
nRecStage = 0;
nRecSize = 0;
varBuffer = 0;
paramCountdown = 0;
paramsChanged = 0;
};
 
virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset);
};
 
#endif // __EOSEVENTPARSER_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/EOSRemote/valuetitles.h
0,0 → 1,263
/* Camera controller header */
#ifndef __VALUETITLES_H__
#define __VALUETITLES_H__
 
#include <inttypes.h>
#include <avr/pgmspace.h>
 
#include <canoneos.h>
#include <valuelist.h>
 
#define VT_MODE_COUNT 16
#define VT_APT_COUNT 54
#define VT_WB_COUNT 7
#define VT_SHSPEED_COUNT 74
#define VT_PSTYLE_COUNT 9
#define VT_ISO_COUNT 19
#define VT_EXPCOR_COUNT 37
 
const ValueTitle<uint8_t, 4> ApertureTitles[] PROGMEM =
{
{0x00, {' ', ' ', '0', 0 } },
{0x08, {' ', ' ', '1', 0 } },
{0x0B, {'1', '.', '1', 0 } },
{0x0C, {'1', '.', '2', 0 } },
{0x0D, {'1', '.', '2', 0 } },
{0x10, {'1', '.', '4', 0 } },
{0x13, {'1', '.', '6', 0 } },
{0x14, {'1', '.', '8', 0 } },
{0x15, {'1', '.', '8', 0 } },
{0x18, {'2', '.', '0', 0 } },
{0x1B, {'2', '.', '2', 0 } },
{0x1C, {'2', '.', '5', 0 } },
{0x1D, {'2', '.', '5', 0 } },
{0x20, {'2', '.', '8', 0 } },
{0x23, {'3', '.', '2', 0 } },
{0x24, {'3', '.', '5', 0 } },
{0x25, {'3', '.', '5', 0 } },
{0x28, {'4', '.', '0', 0 } },
{0x2B, {'4', '.', '5', 0 } },
{0x2C, {'4', '.', '5', 0 } },
{0x2D, {'5', '.', '0', 0 } },
{0x30, {'5', '.', '6', 0 } },
{0x33, {'6', '.', '3', 0 } },
{0x34, {'6', '.', '7', 0 } },
{0x35, {'7', '.', '1', 0 } },
{0x38, {'8', '.', '0', 0 } },
{0x3B, {'9', '.', '0', 0 } },
{0x3C, {'9', '.', '5', 0 } },
{0x3D, {' ', '1', '0', 0 } },
{0x40, {' ', '1', '1', 0 } },
{0x43, {' ', '1', '3', 0 } },
{0x44, {' ', '1', '3', 0 } },
{0x45, {' ', '1', '4', 0 } },
{0x48, {' ', '1', '6', 0 } },
{0x4B, {' ', '1', '8', 0 } },
{0x4C, {' ', '1', '9', 0 } },
{0x4D, {' ', '2', '0', 0 } },
{0x50, {' ', '2', '2', 0 } },
{0x53, {' ', '2', '5', 0 } },
{0x54, {' ', '2', '7', 0 } },
{0x55, {' ', '2', '9', 0 } },
{0x58, {' ', '3', '2', 0 } },
{0x5B, {' ', '3', '6', 0 } },
{0x5C, {' ', '3', '8', 0 } },
{0x5D, {' ', '4', '0', 0 } },
{0x60, {' ', '4', '5', 0 } },
{0x63, {' ', '5', '1', 0 } },
{0x64, {' ', '5', '4', 0 } },
{0x65, {' ', '5', '7', 0 } },
{0x68, {' ', '6', '4', 0 } },
{0x6B, {' ', '7', '2', 0 } },
{0x6C, {' ', '7', '6', 0 } },
{0x6D, {' ', '8', '0', 0 } },
{0x70, {' ', '9', '1', 0 } }
};
 
const ValueTitle<uint8_t, 5> ShutterSpeedTitles[] PROGMEM =
{
{0x0c, {'B','u','l','b',0} },
{0x10, {' ','3','0','"',0} },
{0x13, {' ','2','5','"',0} },
{0x14, {' ','2','0','"',0} },
{0x15, {' ','2','0','"',0} },
{0x18, {' ','1','5','"',0} },
{0x1B, {' ','1','3','"',0} },
{0x1C, {' ','1','0','"',0} },
{0x1D, {' ','1','0','"',0} },
{0x20, {' ',' ','8','"',0} },
{0x23, {' ',' ','6','"',0} },
{0x24, {' ',' ','6','"',0} },
{0x25, {' ',' ','5','"',0} },
{0x28, {' ',' ','4','"',0} },
{0x2B, {' ','3','"','2',0} },
{0x2C, {' ',' ','3','"',0} },
{0x2D, {' ','2','"','5',0} },
{0x30, {' ',' ','2','"',0} },
{0x33, {' ','1','"','6',0} },
{0x34, {' ','1','"','5',0} },
{0x35, {' ','1','"','3',0} },
{0x38, {' ',' ','1','"',0} },
{0x3B, {' ','0','"','8',0} },
{0x3C, {' ','0','"','7',0} },
{0x3D, {' ','0','"','6',0} },
{0x40, {' ','0','"','5',0} },
{0x43, {' ','0','"','4',0} },
{0x44, {' ','0','"','3',0} },
{0x45, {' ','0','"','3',0} },
{0x48, {' ',' ',' ','4',0} },
{0x4B, {' ',' ',' ','5',0} },
{0x4C, {' ',' ',' ','6',0} },
{0x4D, {' ',' ',' ','6',0} },
{0x50, {' ',' ',' ','8',0} },
{0x53, {' ',' ','1','0',0} },
{0x54, {' ',' ','1','0',0} },
{0x55, {' ',' ','1','3',0} },
{0x58, {' ',' ','1','5',0} },
{0x5B, {' ',' ','2','0',0} },
{0x5C, {' ',' ','2','0',0} },
{0x5D, {' ',' ','2','5',0} },
{0x60, {' ',' ','3','0',0} },
{0x63, {' ',' ','4','0',0} },
{0x64, {' ',' ','4','5',0} },
{0x65, {' ',' ','5','0',0} },
{0x68, {' ',' ','6','0',0} },
{0x6B, {' ',' ','8','0',0} },
{0x6C, {' ',' ','9','0',0} },
{0x6D, {' ','1','0','0',0} },
{0x70, {' ','1','2','5',0} },
{0x73, {' ','1','6','0',0} },
{0x74, {' ','1','8','0',0} },
{0x75, {' ','2','0','0',0} },
{0x78, {' ','2','5','0',0} },
{0x7B, {' ','3','2','0',0} },
{0x7C, {' ','3','5','0',0} },
{0x7D, {' ','4','0','0',0} },
{0x80, {' ','5','0','0',0} },
{0x83, {' ','6','4','0',0} },
{0x84, {' ','7','5','0',0} },
{0x85, {' ','8','0','0',0} },
{0x88, {'1','0','0','0',0} },
{0x8B, {'1','2','5','0',0} },
{0x8C, {'1','5','0','0',0} },
{0x8D, {'1','6','0','0',0} },
{0x90, {'2','0','0','0',0} },
{0x93, {'2','5','0','0',0} },
{0x94, {'3','0','0','0',0} },
{0x95, {'3','2','0','0',0} },
{0x98, {'4','0','0','0',0} },
{0x9B, {'5','0','0','0',0} },
{0x9C, {'6','0','0','0',0} },
{0x9D, {'6','4','0','0',0} },
{0xA0, {'8','0','0','0',0} }
};
 
const ValueTitle<uint8_t, 5> IsoTitles[] PROGMEM =
{
{0x28, {'6',' ',' ',' ',0} },
{0x30, {'1','2',' ',' ',0} },
{0x38, {'2','5',' ',' ',0} },
{0x40, {'5','0',' ',' ',0} },
{0x48, {'1','0','0',' ',0} },
{0x4b, {'1','2','5',' ',0} },
{0x4d, {'1','6','0',' ',0} },
{0x50, {'2','0','0',' ',0} },
{0x53, {'2','5','0',' ',0} },
{0x55, {'3','2','0',' ',0} },
{0x58, {'4','0','0',' ',0} },
{0x5b, {'5','0','0',' ',0} },
{0x5d, {'6','4','0',' ',0} },
{0x60, {'8','0','0',' ',0} },
{0x63, {'1','0','0','0',0} },
{0x65, {'1','2','5','0',0} },
{0x68, {'1','6','0','0',0} },
{0x70, {'3','2','0','0',0} },
{0x78, {'6','4','0','0',0} }
};
 
const ValueTitle<uint8_t, 7> ExpCorTitles[] PROGMEM =
{
{0x28, {'+','5',' ',' ',' ',' ',0} },
{0x25, {'+','4',' ','2','/','3',0} },
{0x23, {'+','4',' ','1','/','3',0} },
{0x20, {'+','4',' ',' ',' ',' ',0} },
{0x1d, {'+','3',' ','2','/','3',0} },
{0x1b, {'+','3',' ','1','/','3',0} },
{0x18, {'+','3',' ',' ',' ',' ',0} },
{0x15, {'+','2',' ','2','/','3',0} },
{0x14, {'+','2',' ','1','/','2',0} },
{0x13, {'+','2',' ','1','/','3',0} },
{0x10, {'+','2',' ',' ',' ',' ',0} },
{0x0d, {'+','1',' ','2','/','3',0} },
{0x0c, {'+','1',' ','1','/','2',0} },
{0x0b, {'+','1',' ','1','/','3',0} },
{0x08, {'+','1',' ',' ',' ',' ',0} },
{0x05, {'+','2','/','3',' ',' ',0} },
{0x04, {'+','1','/','2',' ',' ',0} },
{0x03, {'+','1','/','3',' ',' ',0} },
{0x00, {'0',' ',' ',' ',' ',' ',0} },
{0xfd, {'-','1','/','3',' ',' ',0} },
{0xfc, {'-','1','/','2',' ',' ',0} },
{0xfb, {'-','2','/','3',' ',' ',0} },
{0xf8, {'-','1',' ',' ',' ',' ',0} },
{0xf5, {'-','1',' ','1','/','3',0} },
{0xf4, {'-','1',' ','1','/','2',0} },
{0xf3, {'-','1',' ','2','/','3',0} },
{0xf0, {'-','2',' ',' ',' ',' ',0} },
{0xed, {'-','2',' ','1','/','3',0} },
{0xec, {'-','2',' ','1','/','2',0} },
{0xeb, {'-','2',' ','2','/','3',0} },
{0xe8, {'-','3',' ',' ',' ',' ',0} },
{0xe5, {'-','3',' ','1','/','3',0} },
{0xe3, {'-','3',' ','2','/','3',0} },
{0xe0, {'-','4',' ',' ',' ',' ',0} },
{0xdd, {'-','4',' ','1','/','3',0} },
{0xdb, {'-','3',' ','2','/','3',0} },
{0xd8, {'-','5',' ',' ',' ',' ',0} }
};
 
const ValueTitle<uint8_t, 4> ModeTitles[] PROGMEM =
{
{0, {'P',' ',' ',0} },
{1, {'T','v',' ',0} },
{2, {'A','v',' ',0} },
{3, {'M',' ',' ',0} },
{4, {'B','l','b',0} },
{5, {'A','-','D',0} },
{6, {'D','E','P',0} },
{7, {'C',' ',' ',0} },
{8, {'L','c','k',0} },
{9, {'G','r','n',0} },
{10, {'N','g','h',0} },
{11, {'S','p','r',0} },
{13, {'L','n','d',0} },
{14, {'C','l','s',0} },
{15, {'N','/','F',0} }
};
 
const ValueTitle<uint8_t, 4> WbTitles[] PROGMEM =
{
{0, {'A','W','B',0} },
{1, {'D','a','y',0} },
{2, {'C','l','d',0} },
{3, {'T','n','g',0} },
{4, {'F','l','r',0} },
{5, {'S','t','r',0} },
{6, {'W','/','P',0} },
{8, {'S','h','d',0} }
};
 
const ValueTitle<uint8_t, 4> PStyleTitles[] PROGMEM =
{
{0x21, {'U','s','1',0} },
{0x22, {'U','s','2',0} },
{0x23, {'U','s','3',0} },
{0x81, {'S','t','d',0} },
{0x82, {'P','r','t',0} },
{0x83, {'L','n','d',0} },
{0x84, {'N','t','l',0} },
{0x85, {'F','t','h',0} },
{0x86, {'M','o','n',0} }
};
 
#endif //__VALUETITLES_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSCapture/PSCapture.pde
0,0 → 1,106
/* Canon Powershot Capture Demo */
#include <inttypes.h>
#include <avr/pgmspace.h>
 
//#include <Spi.h>
#include <Max3421e.h>
#include <Max3421e_constants.h>
#include <Max_LCD.h>
#include <Usb.h>
 
#include <ptp.h>
#include <ptpdebug.h>
#include <canonps.h>
#include <simpletimer.h>
#include "pseventparser.h"
#include "ptpobjinfoparser.h"
 
#define DEV_ADDR 1
 
// Canon PowerShot S3 IS
#define DATA_IN_EP 1
#define DATA_OUT_EP 2
#define INTERRUPT_EP 3
#define CONFIG_NUM 1
 
void setup();
void loop();
 
class CamStateHandlers : public PSStateHandlers
{
bool stateConnected;
public:
CamStateHandlers() : stateConnected(false) {};
virtual void OnDeviceDisconnectedState(PTP *ptp);
virtual void OnDeviceInitializedState(PTP *ptp);
} CamStates;
 
CanonPS Ps(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);
SimpleTimer eventTimer, captureTimer;
 
void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
{
if (stateConnected)
{
eventTimer.Disable();
captureTimer.Disable();
stateConnected = false;
Notify(PSTR("Camera disconnected\r\n"));
}
}
 
void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
{
if (!stateConnected)
{
Notify(PSTR("stateConnected\r\n"));
stateConnected = true;
eventTimer.Enable();
captureTimer.Enable();
}
}
 
void setup()
{
Serial.begin( 115200 );
Serial.println("Start");
Ps.Setup();
eventTimer.Set(&OnEventTimer, 200);
captureTimer.Set(&OnCaptureTimer, 5000);
delay( 200 );
}
 
void loop()
{
eventTimer.Run();
captureTimer.Run();
Ps.Task();
}
 
void OnCaptureTimer()
{
Ps.SetDevicePropValue(PS_DPC_CaptureTransferMode, (uint16_t)0x0D);
uint16_t rc = Ps.Capture();
if (rc != PTP_RC_OK)
Message(PSTR("Error: "), rc);
}
 
void OnEventTimer()
{
PSEventParser prs;
Ps.EventCheck(&prs);
if (uint32_t handle = prs.GetObjHandle())
{
PTPObjInfoParser inf;
Ps.GetObjectInfo(handle, &inf);
}
}
 
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSCapture/pseventparser.cpp
0,0 → 1,86
#include "pseventparser.h"
 
void PSEventParser::Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset)
{
uint16_t cntdn = (uint16_t)len;
uint8_t *p = (uint8_t*)pbuf;
 
switch (nStage)
{
case 0:
p += 12;
cntdn -= 12;
 
if (!cntdn)
return;
nStage ++;
 
case 1:
//Notify(PSTR("\r\nEvent Block Size:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 2:
if (!valueParser.Parse(&p, &cntdn))
return;
 
//PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 3:
//Notify(PSTR("\r\nNumber of Fields:\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 4:
if (!valueParser.Parse(&p, &cntdn))
return;
 
//PrintHex<uint16_t>(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 5:
//Notify(PSTR("\r\nEvent Code:\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 6:
if (!valueParser.Parse(&p, &cntdn))
return;
 
eventCode = *((uint16_t*)theBuffer.pValue);
//PrintHex<uint16_t>(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 7:
//Notify(PSTR("\r\nTransaction ID:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 8:
if (!valueParser.Parse(&p, &cntdn))
return;
 
//PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 9:
if (eventCode == PTP_EC_ObjectAdded)
Notify(PSTR("\r\nObject Added:\t\t"));
 
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 10:
if (eventCode == PTP_EC_ObjectAdded)
{
if (!valueParser.Parse(&p, &cntdn))
return;
 
objHandle = *((uint32_t*)theBuffer.pValue);
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
Notify(PSTR("\r\n"));
}
if (eventCode == PTP_EC_CaptureComplete)
Notify(PSTR("\r\nCapture complete.\r\n"));
nStage ++;
case 11:
nStage = 0;
}
}
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSCapture/pseventparser.h
0,0 → 1,29
#ifndef __PSEVENTPARSER_H__
#define __PSEVENTPARSER_H__
 
#include <inttypes.h>
#include <avr/pgmspace.h>
#include "ptpcallback.h"
#include "ptpdebug.h"
#include "canonps.h"
 
class PSEventParser : public PTPReadParser
{
MultiValueBuffer theBuffer;
uint32_t varBuffer;
uint8_t nStage;
uint16_t eventCode;
uint32_t objHandle;
 
MultiByteValueParser valueParser;
 
public:
PSEventParser() : nStage(0), varBuffer(0), objHandle(0)
{
theBuffer.pValue = &varBuffer;
};
uint32_t GetObjHandle() { return objHandle; };
virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset);
};
 
#endif // __PSEVENTPARSER_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSCapture/ptpobjinfoparser.cpp
0,0 → 1,298
#include "ptpobjinfoparser.h"
 
const char* PTPObjInfoParser::acNames[] PROGMEM =
{
msgUndefined,
msgAssociation,
msgScript,
msgExecutable,
msgText,
msgHTML,
msgDPOF,
msgAIFF,
msgWAV,
msgMP3,
msgAVI,
msgMPEG,
msgASF,
msgQT
};
 
const char* PTPObjInfoParser::imNames[] PROGMEM =
{
msgUndefined,
msgEXIF_JPEG,
msgTIFF_EP,
msgFlashPix,
msgBMP,
msgCIFF,
msgUndefined_0x3806,
msgGIF,
msgJFIF,
msgPCD,
msgPICT,
msgPNG,
msgUndefined_0x380C,
msgTIFF,
msgTIFF_IT,
msgJP2,
msgJPX,
};
 
void PTPObjInfoParser::PrintFormat(uint16_t op)
{
Serial.print(op, HEX);
Serial.print("\t");
//Notify(msgTab);
 
if ((((op >> 8) & 0xFF) == 0x30) && ((op & 0xFF) <= (PTP_OFC_QT & 0xFF)))
Notify((char*)pgm_read_word(&acNames[(op & 0xFF)]));
else
if ((((op >> 8) & 0xFF) == 0x38) && ((op & 0xFF) <= (PTP_OFC_JPX & 0xFF)))
Notify((char*)pgm_read_word(&imNames[(op & 0xFF)]));
else
{
switch (op)
{
case MTP_OFC_Undefined_Firmware:
Notify(msgUndefined_Firmware);
break;
case MTP_OFC_Windows_Image_Format:
Notify(msgWindows_Image_Format);
break;
case MTP_OFC_Undefined_Audio:
Notify(msgUndefined_Audio);
break;
case MTP_OFC_WMA:
Notify(msgWMA);
break;
case MTP_OFC_OGG:
Notify(msgOGG);
break;
case MTP_OFC_AAC:
Notify(msgAAC);
break;
case MTP_OFC_Audible:
Notify(msgAudible);
break;
case MTP_OFC_FLAC:
Notify(msgFLAC);
break;
case MTP_OFC_Undefined_Video:
Notify(msgUndefined_Video);
break;
case MTP_OFC_WMV:
Notify(msgWMV);
break;
case MTP_OFC_MP4_Container:
Notify(msgMP4_Container);
break;
case MTP_OFC_MP2:
Notify(msgMP2);
break;
case MTP_OFC_3GP_Container:
Notify(msg3GP_Container);
break;
default:
Notify(PSTR("Vendor defined"));
}
}
Notify(PSTR("\r\n"));
}
 
void PTPObjInfoParser::Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset)
{
uint16_t cntdn = (uint16_t)len;
uint8_t *p = (uint8_t*)pbuf;
 
switch (nStage)
{
case 0:
p += 12;
cntdn -= 12;
nStage ++;
case 1:
Notify(PSTR("Storage ID:\t\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 2:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 3:
Notify(PSTR("\r\nObject Format:\t\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 4:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintFormat(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 5:
Notify(PSTR("Protection Status:\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 6:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint16_t>(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 7:
Notify(PSTR("\r\nObject Compressed Size:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 8:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 9:
Notify(PSTR("\r\nThumb Format:\t\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 10:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintFormat(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 11:
Notify(PSTR("Thumb Compressed Size:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 12:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 13:
Notify(PSTR("\r\nThumb Pix Width:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 14:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 15:
Notify(PSTR("\r\nThumb Pix Height:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 16:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 17:
Notify(PSTR("\r\nImage Pix Width:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 18:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 19:
Notify(PSTR("\r\nImage Pix Height:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 20:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 21:
Notify(PSTR("\r\nImage Bit Depth:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 22:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 23:
Notify(PSTR("\r\nParent Object:\t\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 24:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 25:
Notify(PSTR("\r\nAssociation Type:\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 26:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint16_t>(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 27:
Notify(PSTR("\r\nAssociation Desc:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 28:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 29:
Notify(PSTR("\r\nSequence Number:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 30:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 31:
Notify(PSTR("\r\nFile Name:\t\t"));
arrayParser.Initialize(1, 2, &theBuffer);
nStage ++;
case 32:
if (!arrayParser.Parse(&p, &cntdn, (PTP_ARRAY_EL_FUNC)&PrintChar))
return;
nStage ++;
case 33:
Notify(PSTR("\r\nCapture Date:\t\t"));
arrayParser.Initialize(1, 2, &theBuffer);
nStage ++;
case 34:
if (!arrayParser.Parse(&p, &cntdn, (PTP_ARRAY_EL_FUNC)&PrintChar))
return;
nStage ++;
case 35:
Notify(PSTR("\r\nModification Date:\t"));
arrayParser.Initialize(1, 2, &theBuffer);
nStage ++;
case 36:
if (!arrayParser.Parse(&p, &cntdn, (PTP_ARRAY_EL_FUNC)&PrintChar))
return;
nStage ++;
case 37:
Notify(PSTR("\r\nKeywords:\t"));
arrayParser.Initialize(1, 2, &theBuffer);
nStage ++;
case 38:
if (!arrayParser.Parse(&p, &cntdn, (PTP_ARRAY_EL_FUNC)&PrintChar))
return;
Notify(PSTR("\r\n"));
nStage = 0;
}
}
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSCapture/ptpobjinfoparser.h
0,0 → 1,83
#ifndef __PTPOBJINFOPARSER_H__
#define __PTPOBJINFOPARSER_H__
 
#include <ptp.h>
#include <mtpconst.h>
#include <ptpcallback.h>
 
const char msgUndefined [] PROGMEM = "Undefined";
 
// Ancillary formats
const char msgAssociation [] PROGMEM = "Association";
const char msgScript [] PROGMEM = "Script";
const char msgExecutable [] PROGMEM = "Executable";
const char msgText [] PROGMEM = "Text";
const char msgHTML [] PROGMEM = "HTML";
const char msgDPOF [] PROGMEM = "DPOF";
const char msgAIFF [] PROGMEM = "AIFF";
const char msgWAV [] PROGMEM = "WAV";
const char msgMP3 [] PROGMEM = "MP3";
const char msgAVI [] PROGMEM = "AVI";
const char msgMPEG [] PROGMEM = "MPEG";
const char msgASF [] PROGMEM = "ASF";
const char msgQT [] PROGMEM = "QT";
 
// Image formats
const char msgEXIF_JPEG [] PROGMEM = "EXIF_JPEG";
const char msgTIFF_EP [] PROGMEM = "TIFF_EP";
const char msgFlashPix [] PROGMEM = "FlashPix";
const char msgBMP [] PROGMEM = "BMP";
const char msgCIFF [] PROGMEM = "CIFF";
const char msgUndefined_0x3806 [] PROGMEM = "Undefined_0x3806";
const char msgGIF [] PROGMEM = "GIF";
const char msgJFIF [] PROGMEM = "JFIF";
const char msgPCD [] PROGMEM = "PCD";
const char msgPICT [] PROGMEM = "PICT";
const char msgPNG [] PROGMEM = "PNG";
const char msgUndefined_0x380C [] PROGMEM = "Undefined_0x380C";
const char msgTIFF [] PROGMEM = "TIFF";
const char msgTIFF_IT [] PROGMEM = "TIFF_IT";
const char msgJP2 [] PROGMEM = "JP2";
const char msgJPX [] PROGMEM = "JPX";
 
// MTP Object Formats
const char msgUndefined_Firmware [] PROGMEM = "Undefined_Firmware";
const char msgWindows_Image_Format [] PROGMEM = "Windows_Image_Format";
const char msgUndefined_Audio [] PROGMEM = "Undefined_Audio";
const char msgWMA [] PROGMEM = "WMA";
const char msgOGG [] PROGMEM = "OGG";
const char msgAAC [] PROGMEM = "AAC";
const char msgAudible [] PROGMEM = "Audible";
const char msgFLAC [] PROGMEM = "FLAC";
const char msgUndefined_Video [] PROGMEM = "Undefined_Video";
const char msgWMV [] PROGMEM = "WMV";
const char msgMP4_Container [] PROGMEM = "MP4_Container";
const char msgMP2 [] PROGMEM = "MP2";
const char msg3GP_Container [] PROGMEM = "3GP_Container";
 
 
class PTPObjInfoParser : public PTPReadParser
{
static const char* acNames[];
static const char* imNames[];
 
MultiValueBuffer theBuffer;
uint32_t varBuffer;
uint8_t nStage;
 
MultiByteValueParser valueParser;
PTPListParser arrayParser;
 
static void PrintChar(MultiValueBuffer *p)
{
if (((unsigned char*)p->pValue)[0])
Serial.print(((unsigned char*)p->pValue)[0]);
};
void PrintFormat(uint16_t op);
 
public:
PTPObjInfoParser() : nStage(0) { theBuffer.pValue = (uint8_t*)&varBuffer; };
virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset);
};
 
#endif // __PTPOBJINFOPARSER_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSCapture/sample_output.txt
0,0 → 1,96
Session opened
stateConnected
 
Object Added: 00000005
Storage ID: 00010001
Object Format: 3801 EXIF_JPEG
Protection Status: 0000
Object Compressed Size: 00315A1A
Thumb Format: 3808 JFIF
Thumb Compressed Size: 0000107A
Thumb Pix Width: 000000A0
Thumb Pix Height: 00000078
Image Pix Width: 00000E40
Image Pix Height: 00000AB0
Image Bit Depth: 00000000
Parent Object: 00000004
Association Type: 0000
Association Desc: 00000001
Sequence Number: 00000000
File Name: IMG_0991.JPG
Capture Date: 20110115T010141.0
Modification Date:
Keywords:
 
Capture complete.
 
Object Added: 00000006
Storage ID: 00010001
Object Format: 3801 EXIF_JPEG
Protection Status: 0000
Object Compressed Size: 002F6B25
Thumb Format: 3808 JFIF
Thumb Compressed Size: 0000106B
Thumb Pix Width: 000000A0
Thumb Pix Height: 00000078
Image Pix Width: 00000E40
Image Pix Height: 00000AB0
Image Bit Depth: 00000000
Parent Object: 00000004
Association Type: 0000
Association Desc: 00000001
Sequence Number: 00000000
File Name: IMG_0992.JPG
Capture Date: 20110115T010146.0
Modification Date:
Keywords:
 
Capture complete.
 
Object Added: 00000007
Storage ID: 00010001
Object Format: 3801 EXIF_JPEG
Protection Status: 0000
Object Compressed Size: 002FE0BF
Thumb Format: 3808 JFIF
Thumb Compressed Size: 00001085
Thumb Pix Width: 000000A0
Thumb Pix Height: 00000078
Image Pix Width: 00000E40
Image Pix Height: 00000AB0
Image Bit Depth: 00000000
Parent Object: 00000004
Association Type: 0000
Association Desc: 00000001
Sequence Number: 00000000
File Name: IMG_0993.JPG
Capture Date: 20110115T010151.0
Modification Date:
Keywords:
 
Capture complete.
 
Object Added: 00000008
Storage ID: 00010001
Object Format: 3801 EXIF_JPEG
Protection Status: 0000
Object Compressed Size: 002EDF53
Thumb Format: 3808 JFIF
Thumb Compressed Size: 00001082
Thumb Pix Width: 000000A0
Thumb Pix Height: 00000078
Image Pix Width: 00000E40
Image Pix Height: 00000AB0
Image Bit Depth: 00000000
Parent Object: 00000004
Association Type: 0000
Association Desc: 00000001
Sequence Number: 00000000
File Name: IMG_0994.JPG
Capture Date: 20110115T010157.0
Modification Date:
Keywords:
 
Capture complete.
Camera disconnected
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSDevProp/PSDevProp.pde
0,0 → 1,105
/* Canon Powershot Device Property Parser */
#include <inttypes.h>
#include <avr/pgmspace.h>
 
//#include <Spi.h>
#include <Max3421e.h>
#include <Max3421e_constants.h>
#include <Max_LCD.h>
#include <Usb.h>
 
#include <ptp.h>
#include <ptpdebug.h>
#include <canonps.h>
#include <ptpdpparser.h>
#include <psvaluetitles.h>
#include "devpropparser.h"
 
#define DEV_ADDR 1
 
// Canon PowerShot S3 IS
#define DATA_IN_EP 1
#define DATA_OUT_EP 2
#define INTERRUPT_EP 3
#define CONFIG_NUM 1
 
class CamStateHandlers : public PSStateHandlers
{
enum CamStates { stInitial, stDisconnected, stConnected };
CamStates stateConnected;
public:
CamStateHandlers() : stateConnected(stInitial)
{
};
virtual void OnDeviceDisconnectedState(PTP *ptp);
virtual void OnDeviceInitializedState(PTP *ptp);
};
 
CamStateHandlers CamStates;
CanonPS Ps(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);
 
void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
{
if (stateConnected == stConnected || stateConnected == stInitial)
{
stateConnected = stDisconnected;
Notify(PSTR("Camera disconnected\r\n"));
}
}
 
void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
{
if (stateConnected == stDisconnected || stateConnected == stInitial)
{
stateConnected = stConnected;
uint16_t prefix = 0xD000;
uint16_t shoot_mode[] = {0x01, 0x02, 0x03, 0x04};
for (uint8_t i=0; i<4; i++)
{
Ps.SetDevicePropValue(PS_DPC_ShootingMode, (uint16_t)shoot_mode[i]);
delay(10);
 
Notify(PSTR("Mode:"));
PrintValueTitle<uint8_t, VT_MODE, VT_MODE_COUNT, VT_MODE_TEXT_LEN>((PTP*)ptp, PS_DPC_ShootingMode, ModeTitles);
Notify(PSTR("\r\n"));
for (uint8_t j=0; j<128; j++)
{
HexDump dmp;
if (Ps.GetDevicePropDesc((prefix | j), &dmp) == PTP_RC_OK)
{
Notify(PSTR("\r\n"));
DevPropParser prs;
if (Ps.GetDevicePropDesc((prefix | j), &prs) == PTP_RC_OK)
Notify(PSTR("\r\n"));
}
}
Notify(PSTR("\r\n"));
 
} // for (uint8_t i=0; i<4; i++)
 
} // if (stateConnected == stDisconnected || stateConnected == stInitial)
}
 
void setup()
{
Serial.begin( 115200 );
Serial.println("Start");
Ps.Setup();
delay( 200 );
}
 
void loop()
{
Ps.Task();
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSDevProp/devpropparser.cpp
0,0 → 1,368
#include "devpropparser.h"
 
const char* DevPropParser::dtNames1[] PROGMEM =
{
msgUNDEF,
msgINT8,
msgUINT8,
msgINT16,
msgUINT16,
msgINT32,
msgUINT32,
msgINT64,
msgUINT64,
msgINT128,
msgUINT128
};
 
const char* DevPropParser::dtNames2[] PROGMEM =
{
msgUNDEF,
msgAINT8,
msgAUINT8,
msgAINT16,
msgAUINT16,
msgAINT32,
msgAUINT32,
msgAINT64,
msgAUINT64,
msgAINT128,
msgAUINT128
};
 
const char* DevPropParser::prNames[] PROGMEM =
{
msgUndefined,
msgBatteryLevel,
msgFunctionalMode,
msgImageSize,
msgCompressionSetting,
msgWhiteBalance,
msgRGBGain,
msgFNumber,
msgFocalLength,
msgFocusDistance,
msgFocusMode,
msgExposureMeteringMode,
msgFlashMode,
msgExposureTime,
msgExposureProgramMode,
msgExposureIndex,
msgExposureBiasCompensation,
msgDateTime,
msgCaptureDelay,
msgStillCaptureMode,
msgContrast,
msgSharpness,
msgDigitalZoom,
msgEffectMode,
msgBurstNumber,
msgBurstInterval,
msgTimelapseNumber,
msgTimelapseInterval,
msgFocusMeteringMode,
msgUploadURL,
msgArtist,
msgCopyrightInfo
};
 
void DevPropParser::PrintDataType(uint8_t **pp, uint16_t *pcntdn)
{
dataType = *((uint16_t*)(*pp));
bytesSize = GetDataSize();
Notify(PSTR("Data Type:\t\t"));
 
switch (((dataType >> 8) & 0xFF))
{
case 0x00:
if ((dataType & 0xFF) <= (PTP_DTC_UINT128 & 0xFF))
Notify((char*)pgm_read_word(&dtNames1[(dataType & 0xFF)]));
break;
case 0x40:
if ((dataType & 0xFF) <= (PTP_DTC_AUINT128 & 0xFF))
Notify((char*)pgm_read_word(&dtNames2[(dataType & 0xFF)]));
break;
case 0xFF:
Notify(PSTR("STR"));
break;
default:
Notify(PSTR("Unknown"));
}
Notify(PSTR("\r\n"));
(*pp) += 2;
(*pcntdn) -= 2;
}
 
void DevPropParser::PrintDevProp(uint8_t **pp, uint16_t *pcntdn)
{
uint16_t op = *((uint16_t*)(*pp));
 
Notify(PSTR("\r\nDevice Property:\t"));
 
if ((((op >> 8) & 0xFF) == 0x50) && ((op & 0xFF) <= (PTP_DPC_CopyrightInfo & 0xFF)))
{
PrintHex<uint16_t>(op);
Notify(PSTR("\t"));
Notify((char*)pgm_read_word(&prNames[(op & 0xFF)]));
Notify(PSTR("\r\n"));
}
else
{
PrintHex<uint16_t>(op);
Notify(PSTR(" (Vendor defined)\r\n"));
}
(*pp) += 2;
(*pcntdn) -= 2;
}
 
void DevPropParser::PrintGetSet(uint8_t **pp, uint16_t *pcntdn)
{
Notify(PSTR("Get/Set:\t\t"));
Notify(((**pp) == 0x01) ? PSTR("Get/Set\r\n") : (!(**pp)) ? PSTR("Get\r\n") : PSTR("Illegal\r\n"));
(*pp) ++;
(*pcntdn) --;
}
 
uint8_t DevPropParser::GetDataSize()
{
switch (dataType)
{
case PTP_DTC_INT8:
case PTP_DTC_UINT8:
bytesSize = 1;
break;
case PTP_DTC_AINT8:
case PTP_DTC_AUINT8:
bytesSize = 1;
enumParser.Initialize(4, bytesSize, &theBuffer);
break;
case PTP_DTC_INT16:
case PTP_DTC_UINT16:
bytesSize = 2;
enumParser.Initialize(4, bytesSize, &theBuffer);
break;
case PTP_DTC_AINT16:
case PTP_DTC_AUINT16:
bytesSize = 2;
break;
case PTP_DTC_STR:
bytesSize = 2;
enumParser.Initialize(1, bytesSize, &theBuffer);
break;
case PTP_DTC_INT32:
case PTP_DTC_UINT32:
bytesSize = 4;
break;
case PTP_DTC_AINT32:
case PTP_DTC_AUINT32:
bytesSize = 4;
enumParser.Initialize(4, bytesSize, &theBuffer);
break;
case PTP_DTC_INT64:
case PTP_DTC_UINT64:
bytesSize = 8;
break;
case PTP_DTC_AINT64:
case PTP_DTC_AUINT64:
bytesSize = 8;
enumParser.Initialize(4, bytesSize, &theBuffer);
break;
case PTP_DTC_INT128:
case PTP_DTC_UINT128:
bytesSize = 16;
break;
case PTP_DTC_AINT128:
case PTP_DTC_AUINT128:
bytesSize = 16;
enumParser.Initialize(4, bytesSize, &theBuffer);
break;
}
return bytesSize;
}
 
bool DevPropParser::PrintValue(uint8_t **pp, uint16_t *pcntdn)
{
switch (dataType)
{
case PTP_DTC_INT8:
case PTP_DTC_UINT8:
PrintHex<uint8_t>(**pp);
(*pp) ++;
(*pcntdn) --;
break;
case PTP_DTC_AINT8:
case PTP_DTC_AUINT8:
if (!enumParser.Parse(pp, pcntdn, (PTP_ARRAY_EL_FUNC)&PrintByte))
return false;
break;
case PTP_DTC_INT16:
case PTP_DTC_UINT16:
PrintHex<uint16_t>(*((uint16_t*)*pp));
(*pp) += 2;
(*pcntdn) -= 2;
break;
case PTP_DTC_AINT16:
case PTP_DTC_AUINT16:
if (!enumParser.Parse(pp, pcntdn, (PTP_ARRAY_EL_FUNC)&PrintTwoBytes))
return false;
break;
case PTP_DTC_INT32:
case PTP_DTC_UINT32:
PrintHex<uint32_t>(*((uint32_t*)*pp));
(*pp) += 4;
(*pcntdn) -= 4;
break;
case PTP_DTC_AINT32:
case PTP_DTC_AUINT32:
if (!enumParser.Parse(pp, pcntdn, (PTP_ARRAY_EL_FUNC)&PrintFourBytes))
return false;
break;
case PTP_DTC_INT64:
case PTP_DTC_UINT64:
(*pp) += 8;
(*pcntdn) -= 8;
break;
case PTP_DTC_AINT64:
case PTP_DTC_AUINT64:
if (!enumParser.Parse(pp, pcntdn, (PTP_ARRAY_EL_FUNC)&PrintEightBytes))
return false;
break;
case PTP_DTC_INT128:
case PTP_DTC_UINT128:
(*pp) += 16;
(*pcntdn) -= 16;
break;
case PTP_DTC_AINT128:
case PTP_DTC_AUINT128:
if (!enumParser.Parse(pp, pcntdn, NULL))
return false;
break;
case PTP_DTC_STR:
if (!enumParser.Parse(pp, pcntdn, (PTP_ARRAY_EL_FUNC)&PrintChar))
return false;
break;
}
return true;
}
 
bool DevPropParser::ParseEnum(uint8_t **pp, uint16_t *pcntdn)
{
if ((dataType & 0xFF00) == 0)
return ParseEnumSingle(pp, pcntdn);
else
return ParseEnumArray(pp, pcntdn);
}
 
bool DevPropParser::ParseEnumArray(uint8_t **pp, uint16_t *pcntdn)
{
switch(enStage)
{
case 0:
theBuffer.valueSize = 2;
valParser.Initialize(&theBuffer);
enStage = 1;
case 1:
if (!valParser.Parse(pp, pcntdn))
return false;
enLen = 0;
enLen = *((uint16_t*)theBuffer.pValue);
enLenCntdn = enLen;
enumParser.Initialize(4, bytesSize, &theBuffer);
enStage = 2;
case 2:
for (; enLenCntdn; enLenCntdn--)
{
if (!enumParser.Parse(pp, pcntdn, (PTP_ARRAY_EL_FUNC)&PrintEnumValue), PTPListParser::modeArray, this)
return false;
Notify(PSTR("\r\n"));
enumParser.Initialize(4, bytesSize, &theBuffer);
}
enStage = 0;
} // switch
return true;
}
 
bool DevPropParser::ParseEnumSingle(uint8_t **pp, uint16_t *pcntdn)
{
switch(enStage)
{
case 0:
enumParser.Initialize(2, bytesSize, &theBuffer);
// Serial.println(bytesSize, DEC);
enStage = 1;
case 1:
if (!enumParser.Parse(pp, pcntdn, (PTP_ARRAY_EL_FUNC)&PrintEnumValue, this))
return false;
enStage = 0;
} // switch
return true;
}
 
void DevPropParser::Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset)
{
uint16_t cntdn = (uint16_t)len;
uint8_t *p = (uint8_t*)pbuf;
 
switch (nStage)
{
case 0:
p += 12;
cntdn -= 12;
nStage = 1;
case 1:
PrintDevProp(&p, &cntdn);
nStage = 2; //++;
case 2:
PrintDataType(&p, &cntdn);
nStage = 3; //++;
case 3:
PrintGetSet(&p, &cntdn);
nStage = 4; //++;
case 4:
Notify(PSTR("Default Value:\t\t"));
nStage = 5; //++;
case 5:
if (!PrintValue(&p, &cntdn))
return;
Notify(PSTR("\r\n"));
nStage = 6; //++;
case 6:
Notify(PSTR("Current Value:\t\t"));
nStage = 7; //++;
case 7:
if (!PrintValue(&p, &cntdn))
return;
Notify(PSTR("\r\n"));
nStage = 8; //++;
case 8:
formFlag = (*p);
p ++;
cntdn --;
nStage = 9; //++;
case 9:
if (formFlag == 1)
{
Notify(PSTR("Range (Min,Max,Step):\t\t{"));
enumParser.Initialize(2, bytesSize, &theBuffer, PTPListParser::modeRange);
}
if (formFlag == 2)
Notify(PSTR("Enumeration:\t\t{"));
nStage = 10; //++;
case 10:
if (formFlag == 1)
if (!enumParser.Parse(&p, &cntdn, (PTP_ARRAY_EL_FUNC)&PrintEnumValue))
return;
 
if (formFlag == 2)
if (!ParseEnum(&p, &cntdn))
return;
 
if (formFlag)
Notify(PSTR("}\r\n"));
nStage = 0;
}
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSDevProp/devpropparser.h
0,0 → 1,167
#ifndef __DEVPROPPARSER_H__
#define __DEVPROPPARSER_H__
 
#include <inttypes.h>
#include <avr/pgmspace.h>
#include <../ptp/ptpconst.h>
#include <../ptp/ptp.h>
 
// Device properties
const char msgUndefined [] PROGMEM = "Undefined";
const char msgBatteryLevel [] PROGMEM = "BatteryLevel";
const char msgFunctionalMode [] PROGMEM = "FunctionalMode";
const char msgImageSize [] PROGMEM = "ImageSize";
const char msgCompressionSetting [] PROGMEM = "CompressionSetting";
const char msgWhiteBalance [] PROGMEM = "WhiteBalance";
const char msgRGBGain [] PROGMEM = "RGBGain";
const char msgFNumber [] PROGMEM = "FNumber";
const char msgFocalLength [] PROGMEM = "FocalLength";
const char msgFocusDistance [] PROGMEM = "FocusDistance";
const char msgFocusMode [] PROGMEM = "FocusMode";
const char msgExposureMeteringMode [] PROGMEM = "ExposureMeteringMode";
const char msgFlashMode [] PROGMEM = "FlashMode";
const char msgExposureTime [] PROGMEM = "ExposureTime";
const char msgExposureProgramMode [] PROGMEM = "ExposureProgramMode";
const char msgExposureIndex [] PROGMEM = "ExposureIndex";
const char msgExposureBiasCompensation [] PROGMEM = "ExposureBiasCompensation";
const char msgDateTime [] PROGMEM = "DateTime";
const char msgCaptureDelay [] PROGMEM = "CaptureDelay";
const char msgStillCaptureMode [] PROGMEM = "StillCaptureMode";
const char msgContrast [] PROGMEM = "Contrast";
const char msgSharpness [] PROGMEM = "Sharpness";
const char msgDigitalZoom [] PROGMEM = "DigitalZoom";
const char msgEffectMode [] PROGMEM = "EffectMode";
const char msgBurstNumber [] PROGMEM = "BurstNumber";
const char msgBurstInterval [] PROGMEM = "BurstInterval";
const char msgTimelapseNumber [] PROGMEM = "TimelapseNumber";
const char msgTimelapseInterval [] PROGMEM = "TimelapseInterval";
const char msgFocusMeteringMode [] PROGMEM = "FocusMeteringMode";
const char msgUploadURL [] PROGMEM = "UploadURL";
const char msgArtist [] PROGMEM = "Artist";
const char msgCopyrightInfo [] PROGMEM = "CopyrightInfo";
 
// Data Types
const char msgUNDEF [] PROGMEM = "UNDEF";
const char msgINT8 [] PROGMEM = "INT8";
const char msgUINT8 [] PROGMEM = "UINT8";
const char msgINT16 [] PROGMEM = "INT16";
const char msgUINT16 [] PROGMEM = "UINT16";
const char msgINT32 [] PROGMEM = "INT32";
const char msgUINT32 [] PROGMEM = "UINT32";
const char msgINT64 [] PROGMEM = "INT64";
const char msgUINT64 [] PROGMEM = "UINT64";
const char msgINT128 [] PROGMEM = "INT128";
const char msgUINT128 [] PROGMEM = "UINT128";
const char msgAINT8 [] PROGMEM = "AINT8";
const char msgAUINT8 [] PROGMEM = "AUINT8";
const char msgAINT16 [] PROGMEM = "AINT16";
const char msgAUINT16 [] PROGMEM = "AUINT16";
const char msgAINT32 [] PROGMEM = "AINT32";
const char msgAUINT32 [] PROGMEM = "AUINT32";
const char msgAINT64 [] PROGMEM = "AINT64";
const char msgAUINT64 [] PROGMEM = "AUINT64";
const char msgAINT128 [] PROGMEM = "AINT128";
const char msgAUINT128 [] PROGMEM = "AUINT128";
const char msgSTR [] PROGMEM = "STR";
 
 
class DevPropParser : public PTPReadParser
{
static const char* dtNames1[];
static const char* dtNames2[];
static const char* prNames[];
 
uint8_t nStage;
uint8_t enStage;
uint16_t dataType;
uint8_t formFlag;
uint8_t bytesSize;
MultiValueBuffer theBuffer;
uint8_t varBuffer[16];
uint16_t enLen;
uint16_t enLenCntdn;
MultiByteValueParser valParser;
 
void PrintDevProp (uint8_t **pp, uint16_t *pcntdn);
void PrintDataType (uint8_t **pp, uint16_t *pcntdn);
void PrintGetSet (uint8_t **pp, uint16_t *pcntdn);
bool PrintValue (uint8_t **pp, uint16_t *pcntdn);
bool PrintEnum (uint8_t **pp, uint16_t *pcntdn);
bool ParseEnum (uint8_t **pp, uint16_t *pcntdn);
bool ParseEnumSingle (uint8_t **pp, uint16_t *pcntdn);
bool ParseEnumArray (uint8_t **pp, uint16_t *pcntdn);
static void PrintChar(const MultiValueBuffer * const p, uint32_t count, const void *me)
{
if (((unsigned char*)p->pValue)[0])
Serial.print(((unsigned char*)p->pValue)[0]);
};
static void PrintByte(const MultiValueBuffer * const p, uint32_t count, const void *me)
{
if (count)
Notify(PSTR(","));
PrintHex<uint8_t>(((uint8_t*)p->pValue)[0]);
};
static void PrintTwoBytes(const MultiValueBuffer * const p, uint32_t count, const void *me)
{
if (count)
Notify(PSTR(","));
PrintHex<uint16_t>(((uint16_t*)p->pValue)[0]);
};
static void PrintFourBytes(const MultiValueBuffer * const p, uint32_t count, const void *me)
{
if (count)
Notify(PSTR(","));
PrintHex<uint32_t>(((uint32_t*)p->pValue)[0]);
};
static void PrintEightBytes(const MultiValueBuffer * const p, uint32_t count, const void *me)
{
if (count)
Notify(PSTR(","));
for (uint8_t i=p->valueSize; i; i--)
PrintHex<uint8_t>(((uint8_t*)p->pValue)[i-1]);
};
static void PrintEnumValue(const MultiValueBuffer * const p, uint32_t count, const void *me)
{
if (count)
Serial.print(", ");
switch (((MultiValueBuffer*)p)->valueSize)
{
case 1:
PrintHex<uint8_t>(*((uint8_t*)p->pValue));
break;
case 2:
PrintHex<uint16_t>(*((uint16_t*)p->pValue));
break;
case 4:
PrintHex<uint32_t>(*((uint32_t*)p->pValue));
break;
default:
for (uint8_t i=p->valueSize; i; i--)
PrintHex<uint8_t>(((uint8_t*)p->pValue)[i-1]);
}
count++;
};
PTPListParser enumParser;
uint8_t GetDataSize();
public:
DevPropParser() :
nStage(0),
enStage(0),
dataType(0),
formFlag(0),
bytesSize(0),
enLen(0),
enLenCntdn(0)
{
theBuffer.pValue = varBuffer;
}
virtual void Parse(const uint16_t len, const uint8_t * const pbuf, const uint32_t &offset);
};
 
#endif // __DEVPROPPARSER_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSDevProp/sample_output_a640.txt
0,0 → 1,2290
Start
Camera disconnected
Session opened
Mode:P
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 24 00 00 00 02 00 14 10 08 00 00 00 02 D0 04 00
0010: 00 00 00 00 00 02 06 00 00 00 01 00 02 00 03 00
0020: 04 00 05 00
 
Device Property: D002 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
Enumeration: {0000, 0001, 0002, 0003, 0004, 0005}
 
0000: 2C 00 00 00 02 00 14 10 0A 00 00 00 03 D0 06 00
0010: 00 01 00 00 00 01 00 00 00 02 04 00 00 00 00 00
0020: 01 00 00 00 02 00 00 00 03 00 00 00
 
Device Property: D003 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00000001
Current Value: 00000001
Enumeration: {00000000, 00000001, 00000002, 00000003}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 19 00 00 00 02 00 14 10 0E 00 00 00 06 D0 02 00
0010: 01 05 05 02 03 00 05 03 02
 
Device Property: D006 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 05
Current Value: 05
Enumeration: {05, 03, 02}
 
0000: 16 00 00 00 02 00 14 10 10 00 00 00 07 D0 02 00
0010: 00 01 01 02 00 00
 
Device Property: D007 (Vendor defined)
Data Type: UINT8
Get/Set: Get
Default Value: 01
Current Value: 01
Enumeration: {}
 
0000: 1B 00 00 00 02 00 14 10 12 00 00 00 08 D0 02 00
0010: 01 00 00 02 05 00 00 01 03 07 02
 
Device Property: D008 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
Enumeration: {00, 01, 03, 07, 02}
 
Transaction: Response recieve error: 2006
0000: 1C 00 00 00 02 00 14 10 15 00 00 00 0A D0 02 00
0010: 01 02 02 02 06 00 00 01 02 05 06 04
 
Device Property: D00A (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 02
Current Value: 02
Enumeration: {00, 01, 02, 05, 06, 04}
 
Transaction: Response recieve error: 2006
0000: 1A 00 00 00 02 00 14 10 18 00 00 00 0C D0 02 00
0010: 01 01 01 02 04 00 01 02 03 04
 
Device Property: D00C (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 01
Current Value: 01
Enumeration: {01, 02, 03, 04}
 
Transaction: Response recieve error: 2006
0000: 16 00 00 00 02 00 14 10 1B 00 00 00 0E D0 02 00
0010: 00 00 00 02 00 00
 
Device Property: D00E (Vendor defined)
Data Type: UINT8
Get/Set: Get
Default Value: 00
Current Value: 00
Enumeration: {}
 
Transaction: Response recieve error: 2006
0000: 19 00 00 00 02 00 14 10 1E 00 00 00 10 D0 02 00
0010: 01 03 03 02 03 00 03 00 01
 
Device Property: D010 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 03
Current Value: 03
Enumeration: {03, 00, 01}
 
0000: 18 00 00 00 02 00 14 10 20 00 00 00 11 D0 02 00
0010: 01 01 01 02 02 00 01 03
 
Device Property: D011 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 01
Current Value: 01
Enumeration: {01, 03}
 
0000: 1C 00 00 00 02 00 14 10 22 00 00 00 12 D0 04 00
0010: 01 01 30 01 30 02 02 00 01 30 03 30
 
Device Property: D012 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 3001
Current Value: 3001
Enumeration: {3001, 3003}
 
0000: 1D 00 00 00 02 00 14 10 24 00 00 00 13 D0 02 00
0010: 01 00 00 02 07 00 00 01 02 03 04 07 06
 
Device Property: D013 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
Enumeration: {00, 01, 02, 03, 04, 07, 06}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 24 00 00 00 02 00 14 10 2E 00 00 00 1C D0 04 00
0010: 01 00 00 00 00 02 06 00 00 00 45 00 48 00 50 00
0020: 58 00 60 00
 
Device Property: D01C (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0000
Current Value: 0000
Enumeration: {0000, 0045, 0048, 0050, 0058, 0060}
 
0000: 18 00 00 00 02 00 14 10 30 00 00 00 1D D0 04 00
0010: 00 28 00 28 00 02 00 00
 
Device Property: D01D (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0028
Current Value: 0028
Enumeration: {}
 
0000: 18 00 00 00 02 00 14 10 32 00 00 00 1E D0 04 00
0010: 00 60 00 60 00 02 00 00
 
Device Property: D01E (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0060
Current Value: 0060
Enumeration: {}
 
0000: 23 00 00 00 02 00 14 10 34 00 00 00 1F D0 02 00
0010: 01 18 18 02 0D 00 08 0B 0D 10 13 15 18 1B 1D 20
0020: 23 25 28
 
Device Property: D01F (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 18
Current Value: 18
Enumeration: {08, 0B, 0D, 10, 13, 15, 18, 1B, 1D, 20, 23, 25, 28}
 
0000: 23 00 00 00 02 00 14 10 36 00 00 00 20 D0 02 00
0010: 01 18 18 02 0D 00 08 0B 0D 10 13 15 18 1B 1D 20
0020: 23 25 28
 
Device Property: D020 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 18
Current Value: 18
Enumeration: {08, 0B, 0D, 10, 13, 15, 18, 1B, 1D, 20, 23, 25, 28}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 2E 00 00 00 02 00 14 10 40 00 00 00 29 D0 04 00
0010: 01 03 00 03 00 02 0B 00 01 00 02 00 03 00 08 00
0020: 09 00 0A 00 0B 00 0C 00 0D 00 0E 00 0F 00
 
Device Property: D029 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0003
Current Value: 0003
Enumeration: {0001, 0002, 0003, 0008, 0009, 000A, 000B, 000C, 000D, 000E, 000F}
 
0000: 1C 00 00 00 02 00 14 10 42 00 00 00 2A D0 04 00
0010: 01 00 00 00 00 01 00 00 0E 00 01 00
 
Device Property: D02A (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0000
Current Value: 0000
Range (Min,Max,Step): {0000, 000E, 0001}
 
Transaction: Response recieve error: 2006
0000: F0 01 00 00 02 00 14 10 45 00 00 00 2C D0 06 40
0010: 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0040: 00 00 00 00 00 00 00 00 00 02 0F 00 06 00 00 00
0050: B0 0A 00 00 40 0E 00 00 01 00 00 00 00 00 00 00
0060: 00 00 00 00 00 00 00 00 06 00 00 00 B0 0A 00 00
0070: 40 0E 00 00 06 00 00 00 00 00 00 00 00 00 00 00
0080: 00 00 00 00 06 00 00 00 B0 0A 00 00 40 0E 00 00
0090: 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00A0: 06 00 00 00 40 08 00 00 00 0B 00 00 02 00 00 00
00B0: 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00
00C0: 40 08 00 00 00 0B 00 00 07 00 00 00 00 00 00 00
00D0: 00 00 00 00 00 00 00 00 06 00 00 00 40 08 00 00
00E0: 00 0B 00 00 0C 00 00 00 00 00 00 00 00 00 00 00
00F0: 00 00 00 00 06 00 00 00 A8 06 00 00 E0 08 00 00
0100: 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0110: 06 00 00 00 A8 06 00 00 E0 08 00 00 08 00 00 00
0120: 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00
0130: A8 06 00 00 E0 08 00 00 0D 00 00 00 00 00 00 00
0140: 00 00 00 00 00 00 00 00 06 00 00 00 B0 04 00 00
0150: 40 06 00 00 11 00 00 00 00 00 00 00 00 00 00 00
0160: 00 00 00 00 06 00 00 00 B0 04 00 00 40 06 00 00
0170: 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0180: 06 00 00 00 B0 04 00 00 40 06 00 00 13 00 00 00
0190: 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00
01A0: E0 01 00 00 80 02 00 00 05 00 00 00 00 00 00 00
01B0: 00 00 00 00 00 00 00 00 06 00 00 00 E0 01 00 00
01C0: 80 02 00 00 0A 00 00 00 00 00 00 00 00 00 00 00
01D0: 00 00 00 00 06 00 00 00 E0 01 00 00 80 02 00 00
01E0: 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 
 
Device Property: D02C (Vendor defined)
Data Type: AUINT32
Get/Set: Get
Default Value: 00000000,00000000,00000000,00000000,00000000,00000000
Current Value: 00000000,00000000,00000000,00000000,00000000,00000000
Enumeration: {00000AB0, 00000E40, 00000001, 00000000, 00000000, 0000000000000B00, 00000007, 00000000, 00000000, 00000000, 00000006, 00000840, 00000B00, 0000000C, 00000000, 00000000, 00000000, 00000006, 000006A8, 000008E0, 00000003, 00000000, 00000000, 00000000, 00000006, 000006A8, 000008E0, 00000008, 00000000, 00000000, 00000000, 00000006, 000006A8, 000008E0, 0000000D, 00000000, 00000000, 00000000, 00000006, 000004B0, 00000640, 00000011, 00000000, 00000000, 00000000, 00000006, 000004B0, 00000640, 00000012, 00000000, 00000000, 00000000, 00000006, 000004B0, 00000640, 00000013, 00000000, 00000000, 00000000, 00000006, 000001E0, 00000280, 00000005, 00000000, 00000000, 00000000, 00000006, 000001E0, 00000280, 0000000A, 00000000, 00000000, 00000000, 00000006, 000001E0, 00000280, 0000000F, 00000000, 00000000, 00000000
0000: 3A 00 00 00 02 00 14 10 47 00 00 00 2D D0 06 40
0010: 00 04 00 00 00 77 00 00 00 00 00 00 00 9F 00 00
0020: 00 00 00 00 00 04 00 00 00 77 00 00 00 00 00 00
0030: 00 9F 00 00 00 00 00 00 00 00
 
Device Property: D02D (Vendor defined)
Data Type: AUINT32
Get/Set: Get
Default Value: 00000077,00000000,0000009F,00000000
Current Value: 00000077,00000000,0000009F,00000000
 
0000: 1A 00 00 00 02 00 14 10 49 00 00 00 2E D0 06 00
0010: 00 00 00 08 00 00 00 08 00 00
 
Device Property: D02E (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00080000
Current Value: 00080000
 
0000: 1A 00 00 00 02 00 14 10 4B 00 00 00 2F D0 06 00
0010: 00 00 00 04 00 00 00 04 00 00
 
Device Property: D02F (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00040000
Current Value: 00040000
 
0000: 1A 00 00 00 02 00 14 10 4D 00 00 00 30 D0 06 00
0010: 00 00 01 00 00 00 01 00 00 00
 
Device Property: D030 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00000100
Current Value: 00000100
 
0000: 1A 00 00 00 02 00 14 10 4F 00 00 00 31 D0 06 00
0010: 00 00 00 00 01 00 00 00 01 00
 
Device Property: D031 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 01000000
Current Value: 01000000
 
0000: 68 00 00 00 02 00 14 10 51 00 00 00 32 D0 FF FF
0010: 00 15 43 00 61 00 6E 00 6F 00 6E 00 20 00 50 00
0020: 6F 00 77 00 65 00 72 00 53 00 68 00 6F 00 74 00
0030: 20 00 41 00 36 00 34 00 30 00 00 00 15 43 00 61
0040: 00 6E 00 6F 00 6E 00 20 00 50 00 6F 00 77 00 65
0050: 00 72 00 53 00 68 00 6F 00 74 00 20 00 41 00 36
0060: 00 34 00 30 00 00 00 00
 
Device Property: D032 (Vendor defined)
Data Type: STR
Get/Set: Get
Default Value: Canon PowerShot A640
Current Value: Canon PowerShot A640
 
0000: 1C 00 00 00 02 00 14 10 53 00 00 00 33 D0 02 40
0010: 01 01 00 00 00 00 01 00 00 00 00 00
 
Device Property: D033 (Vendor defined)
Data Type: AUINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
 
0000: 1A 00 00 00 02 00 14 10 55 00 00 00 34 D0 06 00
0010: 01 E8 F7 30 4D E8 F7 30 4D 00
 
Device Property: D034 (Vendor defined)
Data Type: UINT32
Get/Set: Get/Set
Default Value: 4D30F7E8
Current Value: 4D30F7E8
 
Transaction: Response recieve error: 2006
0000: 19 00 00 00 02 00 14 10 58 00 00 00 36 D0 02 00
0010: 01 03 03 02 03 00 01 02 03
 
Device Property: D036 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 03
Current Value: 03
Enumeration: {01, 02, 03}
 
0000: 16 00 00 00 02 00 14 10 5A 00 00 00 37 D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D037 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: 16 00 00 00 02 00 14 10 5C 00 00 00 38 D0 04 00
0010: 00 20 00 20 00 00
 
Device Property: D038 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0020
Current Value: 0020
 
0000: 16 00 00 00 02 00 14 10 5E 00 00 00 39 D0 04 00
0010: 00 40 0E 40 0E 00
 
Device Property: D039 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0E40
Current Value: 0E40
 
Transaction: Response recieve error: 2006
0000: 16 00 00 00 02 00 14 10 61 00 00 00 3B D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D03B (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: 16 00 00 00 02 00 14 10 63 00 00 00 3C D0 04 00
0010: 00 38 00 38 00 00
 
Device Property: D03C (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0038
Current Value: 0038
 
0000: 16 00 00 00 02 00 14 10 65 00 00 00 3D D0 04 00
0010: 00 09 00 09 00 00
 
Device Property: D03D (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0009
Current Value: 0009
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 1C 00 00 00 02 00 14 10 6A 00 00 00 41 D0 04 00
0010: 01 01 00 01 00 02 02 00 01 00 00 00
 
Device Property: D041 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0001
Current Value: 0001
Enumeration: {0001, 0000}
 
0000: 18 00 00 00 02 00 14 10 6C 00 00 00 42 D0 04 00
0010: 00 02 00 02 00 02 00 00
 
Device Property: D042 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0002
Current Value: 0002
Enumeration: {}
 
0000: 16 00 00 00 02 00 14 10 6E 00 00 00 43 D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D043 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: 1C 00 00 00 02 00 14 10 70 00 00 00 44 D0 04 00
0010: 01 00 00 00 00 02 02 00 00 00 01 00
 
Device Property: D044 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0000
Current Value: 0000
Enumeration: {0000, 0001}
 
0000: 26 00 00 00 02 00 14 10 72 00 00 00 45 D0 04 00
0010: 01 02 00 04 00 02 07 00 01 00 02 00 03 00 04 00
0020: 05 00 06 00 07 00
 
Device Property: D045 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0002
Current Value: 0004
Enumeration: {0001, 0002, 0003, 0004, 0005, 0006, 0007}
 
0000: 16 00 00 00 02 00 14 10 74 00 00 00 46 D0 04 00
0010: 00 01 01 01 01 00
 
Device Property: D046 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0101
Current Value: 0101
 
0000: 16 00 00 00 02 00 14 10 76 00 00 00 47 D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D047 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: B2 00 00 00 02 00 14 10 78 00 00 00 48 D0 06 40
0010: 00 13 00 00 00 00 10 40 00 00 80 2A 00 00 48 1F
0020: 00 00 00 00 00 00 E4 03 00 00 70 26 00 00 50 19
0030: 00 00 70 11 00 00 00 00 00 00 58 02 00 00 48 12
0040: 00 00 30 0C 00 00 B0 08 00 00 00 00 00 00 50 01
0050: 00 00 00 00 00 00 A8 0F 00 00 B8 08 00 00 58 04
0060: 00 13 00 00 00 00 10 40 00 00 80 2A 00 00 48 1F
0070: 00 00 00 00 00 00 E4 03 00 00 70 26 00 00 50 19
0080: 00 00 70 11 00 00 00 00 00 00 58 02 00 00 48 12
0090: 00 00 30 0C 00 00 B0 08 00 00 00 00 00 00 50 01
00A0: 00 00 00 00 00 00 A8 0F 00 00 B8 08 00 00 58 04
00B0: 00 00
 
Device Property: D048 (Vendor defined)
Data Type: AUINT32
Get/Set: Get
Default Value: 00401000,002A8000,001F4800,00000000,0003E400,00267000,00195000,00117000,00000000,00025800,00124800,000C3000,0008B000,00000000,00015000,00000000,000FA800,0008B800,00045800
Current Value: 00401000,002A8000,001F4800,00000000,0003E400,00267000,00195000,00117000,00000000,00025800,00124800,000C3000,0008B000,00000000,00015000,00000000,000FA800,0008B800,00045800
 
0000: 1A 00 00 00 02 00 14 10 7A 00 00 00 49 D0 06 00
0010: 00 00 00 03 02 00 00 03 02 00
 
Device Property: D049 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 02030000
Current Value: 02030000
 
0000: 1A 00 00 00 02 00 14 10 7C 00 00 00 4A D0 02 00
0010: 01 00 00 02 04 00 00 01 02 03
 
Device Property: D04A (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
Enumeration: {00, 01, 02, 03}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
 
Mode:Tv
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 24 00 00 00 02 00 14 10 B7 00 00 00 02 D0 04 00
0010: 00 00 00 00 00 02 06 00 00 00 01 00 02 00 03 00
0020: 04 00 05 00
 
Device Property: D002 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
Enumeration: {0000, 0001, 0002, 0003, 0004, 0005}
 
0000: 2C 00 00 00 02 00 14 10 B9 00 00 00 03 D0 06 00
0010: 00 01 00 00 00 01 00 00 00 02 04 00 00 00 00 00
0020: 01 00 00 00 02 00 00 00 03 00 00 00
 
Device Property: D003 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00000001
Current Value: 00000001
Enumeration: {00000000, 00000001, 00000002, 00000003}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 19 00 00 00 02 00 14 10 BD 00 00 00 06 D0 02 00
0010: 01 05 05 02 03 00 05 03 02
 
Device Property: D006 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 05
Current Value: 05
Enumeration: {05, 03, 02}
 
0000: 16 00 00 00 02 00 14 10 BF 00 00 00 07 D0 02 00
0010: 00 01 01 02 00 00
 
Device Property: D007 (Vendor defined)
Data Type: UINT8
Get/Set: Get
Default Value: 01
Current Value: 01
Enumeration: {}
 
0000: 1B 00 00 00 02 00 14 10 C1 00 00 00 08 D0 02 00
0010: 01 00 00 02 05 00 00 01 03 07 02
 
Device Property: D008 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
Enumeration: {00, 01, 03, 07, 02}
 
Transaction: Response recieve error: 2006
0000: 19 00 00 00 02 00 14 10 C4 00 00 00 0A D0 02 00
0010: 01 02 02 02 03 00 00 02 06
 
Device Property: D00A (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 02
Current Value: 02
Enumeration: {00, 02, 06}
 
Transaction: Response recieve error: 2006
0000: 1A 00 00 00 02 00 14 10 C7 00 00 00 0C D0 02 00
0010: 01 01 02 02 04 00 01 02 03 04
 
Device Property: D00C (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 01
Current Value: 02
Enumeration: {01, 02, 03, 04}
 
Transaction: Response recieve error: 2006
0000: 16 00 00 00 02 00 14 10 CA 00 00 00 0E D0 02 00
0010: 00 00 00 02 00 00
 
Device Property: D00E (Vendor defined)
Data Type: UINT8
Get/Set: Get
Default Value: 00
Current Value: 00
Enumeration: {}
 
Transaction: Response recieve error: 2006
0000: 19 00 00 00 02 00 14 10 CD 00 00 00 10 D0 02 00
0010: 01 03 03 02 03 00 03 00 01
 
Device Property: D010 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 03
Current Value: 03
Enumeration: {03, 00, 01}
 
0000: 18 00 00 00 02 00 14 10 CF 00 00 00 11 D0 02 00
0010: 01 01 01 02 02 00 01 03
 
Device Property: D011 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 01
Current Value: 01
Enumeration: {01, 03}
 
0000: 1C 00 00 00 02 00 14 10 D1 00 00 00 12 D0 04 00
0010: 01 01 30 01 30 02 02 00 01 30 03 30
 
Device Property: D012 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 3001
Current Value: 3001
Enumeration: {3001, 3003}
 
0000: 1D 00 00 00 02 00 14 10 D3 00 00 00 13 D0 02 00
0010: 01 00 00 02 07 00 00 01 02 03 04 07 06
 
Device Property: D013 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
Enumeration: {00, 01, 02, 03, 04, 07, 06}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 24 00 00 00 02 00 14 10 DD 00 00 00 1C D0 04 00
0010: 01 00 00 00 00 02 06 00 00 00 45 00 48 00 50 00
0020: 58 00 60 00
 
Device Property: D01C (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0000
Current Value: 0000
Enumeration: {0000, 0045, 0048, 0050, 0058, 0060}
 
0000: 18 00 00 00 02 00 14 10 DF 00 00 00 1D D0 04 00
0010: 00 28 00 28 00 02 00 00
 
Device Property: D01D (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0028
Current Value: 0028
Enumeration: {}
 
0000: 76 00 00 00 02 00 14 10 E1 00 00 00 1E D0 04 00
0010: 01 60 00 60 00 02 2F 00 18 00 1B 00 1D 00 20 00
0020: 23 00 25 00 28 00 2B 00 2D 00 30 00 33 00 35 00
0030: 38 00 3B 00 3D 00 40 00 43 00 45 00 48 00 4B 00
0040: 4D 00 50 00 53 00 55 00 58 00 5B 00 5D 00 60 00
0050: 63 00 65 00 68 00 6B 00 6D 00 70 00 73 00 75 00
0060: 78 00 7B 00 7D 00 80 00 83 00 85 00 88 00 8B 00
0070: 8D 00 90 00 93 00
 
Device Property: D01E (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0060
Current Value: 0060
Enumeration: {0018, 001B, 001D, 0020, 0023, 0025, 0028, 002B, 002D, 0030, 0033, 0035, 0038, 003B, 003D, 0040, 0043, 0045, 0048, 004B, 004D, 0050, 0053, 0055, 0058, 005B, 005D, 0060, 0063, 0065, 0068, 006B, 006D, 0070, 0073, 0075, 0078, 007B, 007D, 0080, 0083, 0085, 0088, 008B, 008D, 0090, 0093}
 
0000: 23 00 00 00 02 00 14 10 E3 00 00 00 1F D0 02 00
0010: 01 18 18 02 0D 00 08 0B 0D 10 13 15 18 1B 1D 20
0020: 23 25 28
 
Device Property: D01F (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 18
Current Value: 18
Enumeration: {08, 0B, 0D, 10, 13, 15, 18, 1B, 1D, 20, 23, 25, 28}
 
0000: 23 00 00 00 02 00 14 10 E5 00 00 00 20 D0 02 00
0010: 01 18 18 02 0D 00 08 0B 0D 10 13 15 18 1B 1D 20
0020: 23 25 28
 
Device Property: D020 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 18
Current Value: 18
Enumeration: {08, 0B, 0D, 10, 13, 15, 18, 1B, 1D, 20, 23, 25, 28}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 2E 00 00 00 02 00 14 10 EF 00 00 00 29 D0 04 00
0010: 01 03 00 03 00 02 0B 00 01 00 02 00 03 00 08 00
0020: 09 00 0A 00 0B 00 0C 00 0D 00 0E 00 0F 00
 
Device Property: D029 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0003
Current Value: 0003
Enumeration: {0001, 0002, 0003, 0008, 0009, 000A, 000B, 000C, 000D, 000E, 000F}
 
0000: 1C 00 00 00 02 00 14 10 F1 00 00 00 2A D0 04 00
0010: 01 00 00 00 00 01 00 00 0E 00 01 00
 
Device Property: D02A (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0000
Current Value: 0000
Range (Min,Max,Step): {0000, 000E, 0001}
 
Transaction: Response recieve error: 2006
0000: F0 01 00 00 02 00 14 10 F4 00 00 00 2C D0 06 40
0010: 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0040: 00 00 00 00 00 00 00 00 00 02 0F 00 06 00 00 00
0050: B0 0A 00 00 40 0E 00 00 01 00 00 00 00 00 00 00
0060: 00 00 00 00 00 00 00 00 06 00 00 00 B0 0A 00 00
0070: 40 0E 00 00 06 00 00 00 00 00 00 00 00 00 00 00
0080: 00 00 00 00 06 00 00 00 B0 0A 00 00 40 0E 00 00
0090: 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00A0: 06 00 00 00 40 08 00 00 00 0B 00 00 02 00 00 00
00B0: 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00
00C0: 40 08 00 00 00 0B 00 00 07 00 00 00 00 00 00 00
00D0: 00 00 00 00 00 00 00 00 06 00 00 00 40 08 00 00
00E0: 00 0B 00 00 0C 00 00 00 00 00 00 00 00 00 00 00
00F0: 00 00 00 00 06 00 00 00 A8 06 00 00 E0 08 00 00
0100: 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0110: 06 00 00 00 A8 06 00 00 E0 08 00 00 08 00 00 00
0120: 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00
0130: A8 06 00 00 E0 08 00 00 0D 00 00 00 00 00 00 00
0140: 00 00 00 00 00 00 00 00 06 00 00 00 B0 04 00 00
0150: 40 06 00 00 11 00 00 00 00 00 00 00 00 00 00 00
0160: 00 00 00 00 06 00 00 00 B0 04 00 00 40 06 00 00
0170: 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0180: 06 00 00 00 B0 04 00 00 40 06 00 00 13 00 00 00
0190: 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00
01A0: E0 01 00 00 80 02 00 00 05 00 00 00 00 00 00 00
01B0: 00 00 00 00 00 00 00 00 06 00 00 00 E0 01 00 00
01C0: 80 02 00 00 0A 00 00 00 00 00 00 00 00 00 00 00
01D0: 00 00 00 00 06 00 00 00 E0 01 00 00 80 02 00 00
01E0: 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 
 
Device Property: D02C (Vendor defined)
Data Type: AUINT32
Get/Set: Get
Default Value: 00000000,00000000,00000000,00000000,00000000,00000000
Current Value: 00000000,00000000,00000000,00000000,00000000,00000000
Enumeration: {00000AB0, 00000E40, 00000001, 00000000, 00000000, 0000000000000B00, 00000007, 00000000, 00000000, 00000000, 00000006, 00000840, 00000B00, 0000000C, 00000000, 00000000, 00000000, 00000006, 000006A8, 000008E0, 00000003, 00000000, 00000000, 00000000, 00000006, 000006A8, 000008E0, 00000008, 00000000, 00000000, 00000000, 00000006, 000006A8, 000008E0, 0000000D, 00000000, 00000000, 00000000, 00000006, 000004B0, 00000640, 00000011, 00000000, 00000000, 00000000, 00000006, 000004B0, 00000640, 00000012, 00000000, 00000000, 00000000, 00000006, 000004B0, 00000640, 00000013, 00000000, 00000000, 00000000, 00000006, 000001E0, 00000280, 00000005, 00000000, 00000000, 00000000, 00000006, 000001E0, 00000280, 0000000A, 00000000, 00000000, 00000000, 00000006, 000001E0, 00000280, 0000000F, 00000000, 00000000, 00000000
0000: 3A 00 00 00 02 00 14 10 F6 00 00 00 2D D0 06 40
0010: 00 04 00 00 00 77 00 00 00 00 00 00 00 9F 00 00
0020: 00 00 00 00 00 04 00 00 00 77 00 00 00 00 00 00
0030: 00 9F 00 00 00 00 00 00 00 00
 
Device Property: D02D (Vendor defined)
Data Type: AUINT32
Get/Set: Get
Default Value: 00000077,00000000,0000009F,00000000
Current Value: 00000077,00000000,0000009F,00000000
 
0000: 1A 00 00 00 02 00 14 10 F8 00 00 00 2E D0 06 00
0010: 00 00 00 08 00 00 00 08 00 00
 
Device Property: D02E (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00080000
Current Value: 00080000
 
0000: 1A 00 00 00 02 00 14 10 FA 00 00 00 2F D0 06 00
0010: 00 00 00 04 00 00 00 04 00 00
 
Device Property: D02F (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00040000
Current Value: 00040000
 
0000: 1A 00 00 00 02 00 14 10 FC 00 00 00 30 D0 06 00
0010: 00 00 01 00 00 00 01 00 00 00
 
Device Property: D030 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00000100
Current Value: 00000100
 
0000: 1A 00 00 00 02 00 14 10 FE 00 00 00 31 D0 06 00
0010: 00 00 00 00 01 00 00 00 01 00
 
Device Property: D031 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 01000000
Current Value: 01000000
 
0000: 68 00 00 00 02 00 14 10 00 01 00 00 32 D0 FF FF
0010: 00 15 43 00 61 00 6E 00 6F 00 6E 00 20 00 50 00
0020: 6F 00 77 00 65 00 72 00 53 00 68 00 6F 00 74 00
0030: 20 00 41 00 36 00 34 00 30 00 00 00 15 43 00 61
0040: 00 6E 00 6F 00 6E 00 20 00 50 00 6F 00 77 00 65
0050: 00 72 00 53 00 68 00 6F 00 74 00 20 00 41 00 36
0060: 00 34 00 30 00 00 00 00
 
Device Property: D032 (Vendor defined)
Data Type: STR
Get/Set: Get
Default Value: Canon PowerShot A640
Current Value: Canon PowerShot A640
 
0000: 1C 00 00 00 02 00 14 10 02 01 00 00 33 D0 02 40
0010: 01 01 00 00 00 00 01 00 00 00 00 00
 
Device Property: D033 (Vendor defined)
Data Type: AUINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
 
0000: 1A 00 00 00 02 00 14 10 04 01 00 00 34 D0 06 00
0010: 01 EB F7 30 4D EB F7 30 4D 00
 
Device Property: D034 (Vendor defined)
Data Type: UINT32
Get/Set: Get/Set
Default Value: 4D30F7EB
Current Value: 4D30F7EB
 
Transaction: Response recieve error: 2006
0000: 19 00 00 00 02 00 14 10 07 01 00 00 36 D0 02 00
0010: 01 03 03 02 03 00 01 02 03
 
Device Property: D036 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 03
Current Value: 03
Enumeration: {01, 02, 03}
 
0000: 16 00 00 00 02 00 14 10 09 01 00 00 37 D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D037 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: 16 00 00 00 02 00 14 10 0B 01 00 00 38 D0 04 00
0010: 00 20 00 20 00 00
 
Device Property: D038 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0020
Current Value: 0020
 
0000: 16 00 00 00 02 00 14 10 0D 01 00 00 39 D0 04 00
0010: 00 40 0E 40 0E 00
 
Device Property: D039 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0E40
Current Value: 0E40
 
Transaction: Response recieve error: 2006
0000: 16 00 00 00 02 00 14 10 10 01 00 00 3B D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D03B (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: 16 00 00 00 02 00 14 10 12 01 00 00 3C D0 04 00
0010: 00 38 00 38 00 00
 
Device Property: D03C (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0038
Current Value: 0038
 
0000: 16 00 00 00 02 00 14 10 14 01 00 00 3D D0 04 00
0010: 00 09 00 09 00 00
 
Device Property: D03D (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0009
Current Value: 0009
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 1C 00 00 00 02 00 14 10 19 01 00 00 41 D0 04 00
0010: 01 01 00 01 00 02 02 00 01 00 00 00
 
Device Property: D041 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0001
Current Value: 0001
Enumeration: {0001, 0000}
 
0000: 18 00 00 00 02 00 14 10 1B 01 00 00 42 D0 04 00
0010: 00 02 00 02 00 02 00 00
 
Device Property: D042 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0002
Current Value: 0002
Enumeration: {}
 
0000: 16 00 00 00 02 00 14 10 1D 01 00 00 43 D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D043 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: 1C 00 00 00 02 00 14 10 1F 01 00 00 44 D0 04 00
0010: 01 00 00 00 00 02 02 00 00 00 01 00
 
Device Property: D044 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0000
Current Value: 0000
Enumeration: {0000, 0001}
 
0000: 26 00 00 00 02 00 14 10 21 01 00 00 45 D0 04 00
0010: 01 02 00 04 00 02 07 00 01 00 02 00 03 00 04 00
0020: 05 00 06 00 07 00
 
Device Property: D045 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0002
Current Value: 0004
Enumeration: {0001, 0002, 0003, 0004, 0005, 0006, 0007}
 
0000: 16 00 00 00 02 00 14 10 23 01 00 00 46 D0 04 00
0010: 00 01 01 01 01 00
 
Device Property: D046 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0101
Current Value: 0101
 
0000: 16 00 00 00 02 00 14 10 25 01 00 00 47 D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D047 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: B2 00 00 00 02 00 14 10 27 01 00 00 48 D0 06 40
0010: 00 13 00 00 00 00 10 40 00 00 80 2A 00 00 48 1F
0020: 00 00 00 00 00 00 E4 03 00 00 70 26 00 00 50 19
0030: 00 00 70 11 00 00 00 00 00 00 58 02 00 00 48 12
0040: 00 00 30 0C 00 00 B0 08 00 00 00 00 00 00 50 01
0050: 00 00 00 00 00 00 A8 0F 00 00 B8 08 00 00 58 04
0060: 00 13 00 00 00 00 10 40 00 00 80 2A 00 00 48 1F
0070: 00 00 00 00 00 00 E4 03 00 00 70 26 00 00 50 19
0080: 00 00 70 11 00 00 00 00 00 00 58 02 00 00 48 12
0090: 00 00 30 0C 00 00 B0 08 00 00 00 00 00 00 50 01
00A0: 00 00 00 00 00 00 A8 0F 00 00 B8 08 00 00 58 04
00B0: 00 00
 
Device Property: D048 (Vendor defined)
Data Type: AUINT32
Get/Set: Get
Default Value: 00401000,002A8000,001F4800,00000000,0003E400,00267000,00195000,00117000,00000000,00025800,00124800,000C3000,0008B000,00000000,00015000,00000000,000FA800,0008B800,00045800
Current Value: 00401000,002A8000,001F4800,00000000,0003E400,00267000,00195000,00117000,00000000,00025800,00124800,000C3000,0008B000,00000000,00015000,00000000,000FA800,0008B800,00045800
 
0000: 1A 00 00 00 02 00 14 10 29 01 00 00 49 D0 06 00
0010: 00 00 00 03 02 00 00 03 02 00
 
Device Property: D049 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 02030000
Current Value: 02030000
 
0000: 1A 00 00 00 02 00 14 10 2B 01 00 00 4A D0 02 00
0010: 01 00 00 02 04 00 00 01 02 03
 
Device Property: D04A (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
Enumeration: {00, 01, 02, 03}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
 
Mode:Av
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 24 00 00 00 02 00 14 10 66 01 00 00 02 D0 04 00
0010: 00 00 00 00 00 02 06 00 00 00 01 00 02 00 03 00
0020: 04 00 05 00
 
Device Property: D002 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
Enumeration: {0000, 0001, 0002, 0003, 0004, 0005}
 
0000: 2C 00 00 00 02 00 14 10 68 01 00 00 03 D0 06 00
0010: 00 01 00 00 00 01 00 00 00 02 04 00 00 00 00 00
0020: 01 00 00 00 02 00 00 00 03 00 00 00
 
Device Property: D003 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00000001
Current Value: 00000001
Enumeration: {00000000, 00000001, 00000002, 00000003}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 19 00 00 00 02 00 14 10 6C 01 00 00 06 D0 02 00
0010: 01 05 05 02 03 00 05 03 02
 
Device Property: D006 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 05
Current Value: 05
Enumeration: {05, 03, 02}
 
0000: 16 00 00 00 02 00 14 10 6E 01 00 00 07 D0 02 00
0010: 00 01 01 02 00 00
 
Device Property: D007 (Vendor defined)
Data Type: UINT8
Get/Set: Get
Default Value: 01
Current Value: 01
Enumeration: {}
 
0000: 1B 00 00 00 02 00 14 10 70 01 00 00 08 D0 02 00
0010: 01 00 00 02 05 00 00 01 03 07 02
 
Device Property: D008 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
Enumeration: {00, 01, 03, 07, 02}
 
Transaction: Response recieve error: 2006
0000: 1A 00 00 00 02 00 14 10 73 01 00 00 0A D0 02 00
0010: 01 02 02 02 04 00 00 02 06 04
 
Device Property: D00A (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 02
Current Value: 02
Enumeration: {00, 02, 06, 04}
 
Transaction: Response recieve error: 2006
0000: 1A 00 00 00 02 00 14 10 76 01 00 00 0C D0 02 00
0010: 01 01 03 02 04 00 01 02 03 04
 
Device Property: D00C (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 01
Current Value: 03
Enumeration: {01, 02, 03, 04}
 
Transaction: Response recieve error: 2006
0000: 16 00 00 00 02 00 14 10 79 01 00 00 0E D0 02 00
0010: 00 00 00 02 00 00
 
Device Property: D00E (Vendor defined)
Data Type: UINT8
Get/Set: Get
Default Value: 00
Current Value: 00
Enumeration: {}
 
Transaction: Response recieve error: 2006
0000: 19 00 00 00 02 00 14 10 7C 01 00 00 10 D0 02 00
0010: 01 03 03 02 03 00 03 00 01
 
Device Property: D010 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 03
Current Value: 03
Enumeration: {03, 00, 01}
 
0000: 18 00 00 00 02 00 14 10 7E 01 00 00 11 D0 02 00
0010: 01 01 01 02 02 00 01 03
 
Device Property: D011 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 01
Current Value: 01
Enumeration: {01, 03}
 
0000: 1C 00 00 00 02 00 14 10 80 01 00 00 12 D0 04 00
0010: 01 01 30 01 30 02 02 00 01 30 03 30
 
Device Property: D012 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 3001
Current Value: 3001
Enumeration: {3001, 3003}
 
0000: 1D 00 00 00 02 00 14 10 82 01 00 00 13 D0 02 00
0010: 01 00 00 02 07 00 00 01 02 03 04 07 06
 
Device Property: D013 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
Enumeration: {00, 01, 02, 03, 04, 07, 06}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 24 00 00 00 02 00 14 10 8C 01 00 00 1C D0 04 00
0010: 01 00 00 00 00 02 06 00 00 00 45 00 48 00 50 00
0020: 58 00 60 00
 
Device Property: D01C (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0000
Current Value: 0000
Enumeration: {0000, 0045, 0048, 0050, 0058, 0060}
 
0000: 2C 00 00 00 02 00 14 10 8E 01 00 00 1D D0 04 00
0010: 01 28 00 28 00 02 0A 00 20 00 23 00 25 00 28 00
0020: 2B 00 2D 00 30 00 33 00 35 00 38 00
 
Device Property: D01D (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0028
Current Value: 0028
Enumeration: {0020, 0023, 0025, 0028, 002B, 002D, 0030, 0033, 0035, 0038}
 
0000: 18 00 00 00 02 00 14 10 90 01 00 00 1E D0 04 00
0010: 00 60 00 60 00 02 00 00
 
Device Property: D01E (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0060
Current Value: 0060
Enumeration: {}
 
0000: 23 00 00 00 02 00 14 10 92 01 00 00 1F D0 02 00
0010: 01 18 18 02 0D 00 08 0B 0D 10 13 15 18 1B 1D 20
0020: 23 25 28
 
Device Property: D01F (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 18
Current Value: 18
Enumeration: {08, 0B, 0D, 10, 13, 15, 18, 1B, 1D, 20, 23, 25, 28}
 
0000: 23 00 00 00 02 00 14 10 94 01 00 00 20 D0 02 00
0010: 01 18 18 02 0D 00 08 0B 0D 10 13 15 18 1B 1D 20
0020: 23 25 28
 
Device Property: D020 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 18
Current Value: 18
Enumeration: {08, 0B, 0D, 10, 13, 15, 18, 1B, 1D, 20, 23, 25, 28}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 2E 00 00 00 02 00 14 10 9E 01 00 00 29 D0 04 00
0010: 01 03 00 03 00 02 0B 00 01 00 02 00 03 00 08 00
0020: 09 00 0A 00 0B 00 0C 00 0D 00 0E 00 0F 00
 
Device Property: D029 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0003
Current Value: 0003
Enumeration: {0001, 0002, 0003, 0008, 0009, 000A, 000B, 000C, 000D, 000E, 000F}
 
0000: 1C 00 00 00 02 00 14 10 A0 01 00 00 2A D0 04 00
0010: 01 00 00 00 00 01 00 00 0E 00 01 00
 
Device Property: D02A (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0000
Current Value: 0000
Range (Min,Max,Step): {0000, 000E, 0001}
 
Transaction: Response recieve error: 2006
0000: F0 01 00 00 02 00 14 10 A3 01 00 00 2C D0 06 40
0010: 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0040: 00 00 00 00 00 00 00 00 00 02 0F 00 06 00 00 00
0050: B0 0A 00 00 40 0E 00 00 01 00 00 00 00 00 00 00
0060: 00 00 00 00 00 00 00 00 06 00 00 00 B0 0A 00 00
0070: 40 0E 00 00 06 00 00 00 00 00 00 00 00 00 00 00
0080: 00 00 00 00 06 00 00 00 B0 0A 00 00 40 0E 00 00
0090: 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00A0: 06 00 00 00 40 08 00 00 00 0B 00 00 02 00 00 00
00B0: 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00
00C0: 40 08 00 00 00 0B 00 00 07 00 00 00 00 00 00 00
00D0: 00 00 00 00 00 00 00 00 06 00 00 00 40 08 00 00
00E0: 00 0B 00 00 0C 00 00 00 00 00 00 00 00 00 00 00
00F0: 00 00 00 00 06 00 00 00 A8 06 00 00 E0 08 00 00
0100: 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0110: 06 00 00 00 A8 06 00 00 E0 08 00 00 08 00 00 00
0120: 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00
0130: A8 06 00 00 E0 08 00 00 0D 00 00 00 00 00 00 00
0140: 00 00 00 00 00 00 00 00 06 00 00 00 B0 04 00 00
0150: 40 06 00 00 11 00 00 00 00 00 00 00 00 00 00 00
0160: 00 00 00 00 06 00 00 00 B0 04 00 00 40 06 00 00
0170: 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0180: 06 00 00 00 B0 04 00 00 40 06 00 00 13 00 00 00
0190: 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00
01A0: E0 01 00 00 80 02 00 00 05 00 00 00 00 00 00 00
01B0: 00 00 00 00 00 00 00 00 06 00 00 00 E0 01 00 00
01C0: 80 02 00 00 0A 00 00 00 00 00 00 00 00 00 00 00
01D0: 00 00 00 00 06 00 00 00 E0 01 00 00 80 02 00 00
01E0: 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 
 
Device Property: D02C (Vendor defined)
Data Type: AUINT32
Get/Set: Get
Default Value: 00000000,00000000,00000000,00000000,00000000,00000000
Current Value: 00000000,00000000,00000000,00000000,00000000,00000000
Enumeration: {00000AB0, 00000E40, 00000001, 00000000, 00000000, 0000000000000B00, 00000007, 00000000, 00000000, 00000000, 00000006, 00000840, 00000B00, 0000000C, 00000000, 00000000, 00000000, 00000006, 000006A8, 000008E0, 00000003, 00000000, 00000000, 00000000, 00000006, 000006A8, 000008E0, 00000008, 00000000, 00000000, 00000000, 00000006, 000006A8, 000008E0, 0000000D, 00000000, 00000000, 00000000, 00000006, 000004B0, 00000640, 00000011, 00000000, 00000000, 00000000, 00000006, 000004B0, 00000640, 00000012, 00000000, 00000000, 00000000, 00000006, 000004B0, 00000640, 00000013, 00000000, 00000000, 00000000, 00000006, 000001E0, 00000280, 00000005, 00000000, 00000000, 00000000, 00000006, 000001E0, 00000280, 0000000A, 00000000, 00000000, 00000000, 00000006, 000001E0, 00000280, 0000000F, 00000000, 00000000, 00000000
0000: 3A 00 00 00 02 00 14 10 A5 01 00 00 2D D0 06 40
0010: 00 04 00 00 00 77 00 00 00 00 00 00 00 9F 00 00
0020: 00 00 00 00 00 04 00 00 00 77 00 00 00 00 00 00
0030: 00 9F 00 00 00 00 00 00 00 00
 
Device Property: D02D (Vendor defined)
Data Type: AUINT32
Get/Set: Get
Default Value: 00000077,00000000,0000009F,00000000
Current Value: 00000077,00000000,0000009F,00000000
 
0000: 1A 00 00 00 02 00 14 10 A7 01 00 00 2E D0 06 00
0010: 00 00 00 08 00 00 00 08 00 00
 
Device Property: D02E (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00080000
Current Value: 00080000
 
0000: 1A 00 00 00 02 00 14 10 A9 01 00 00 2F D0 06 00
0010: 00 00 00 04 00 00 00 04 00 00
 
Device Property: D02F (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00040000
Current Value: 00040000
 
0000: 1A 00 00 00 02 00 14 10 AB 01 00 00 30 D0 06 00
0010: 00 00 01 00 00 00 01 00 00 00
 
Device Property: D030 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00000100
Current Value: 00000100
 
0000: 1A 00 00 00 02 00 14 10 AD 01 00 00 31 D0 06 00
0010: 00 00 00 00 01 00 00 00 01 00
 
Device Property: D031 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 01000000
Current Value: 01000000
 
0000: 68 00 00 00 02 00 14 10 AF 01 00 00 32 D0 FF FF
0010: 00 15 43 00 61 00 6E 00 6F 00 6E 00 20 00 50 00
0020: 6F 00 77 00 65 00 72 00 53 00 68 00 6F 00 74 00
0030: 20 00 41 00 36 00 34 00 30 00 00 00 15 43 00 61
0040: 00 6E 00 6F 00 6E 00 20 00 50 00 6F 00 77 00 65
0050: 00 72 00 53 00 68 00 6F 00 74 00 20 00 41 00 36
0060: 00 34 00 30 00 00 00 00
 
Device Property: D032 (Vendor defined)
Data Type: STR
Get/Set: Get
Default Value: Canon PowerShot A640
Current Value: Canon PowerShot A640
 
0000: 1C 00 00 00 02 00 14 10 B1 01 00 00 33 D0 02 40
0010: 01 01 00 00 00 00 01 00 00 00 00 00
 
Device Property: D033 (Vendor defined)
Data Type: AUINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
 
0000: 1A 00 00 00 02 00 14 10 B3 01 00 00 34 D0 06 00
0010: 01 EE F7 30 4D EE F7 30 4D 00
 
Device Property: D034 (Vendor defined)
Data Type: UINT32
Get/Set: Get/Set
Default Value: 4D30F7EE
Current Value: 4D30F7EE
 
Transaction: Response recieve error: 2006
0000: 19 00 00 00 02 00 14 10 B6 01 00 00 36 D0 02 00
0010: 01 03 03 02 03 00 01 02 03
 
Device Property: D036 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 03
Current Value: 03
Enumeration: {01, 02, 03}
 
0000: 16 00 00 00 02 00 14 10 B8 01 00 00 37 D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D037 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: 16 00 00 00 02 00 14 10 BA 01 00 00 38 D0 04 00
0010: 00 20 00 20 00 00
 
Device Property: D038 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0020
Current Value: 0020
 
0000: 16 00 00 00 02 00 14 10 BC 01 00 00 39 D0 04 00
0010: 00 40 0E 40 0E 00
 
Device Property: D039 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0E40
Current Value: 0E40
 
Transaction: Response recieve error: 2006
0000: 16 00 00 00 02 00 14 10 BF 01 00 00 3B D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D03B (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: 16 00 00 00 02 00 14 10 C1 01 00 00 3C D0 04 00
0010: 00 38 00 38 00 00
 
Device Property: D03C (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0038
Current Value: 0038
 
0000: 16 00 00 00 02 00 14 10 C3 01 00 00 3D D0 04 00
0010: 00 09 00 09 00 00
 
Device Property: D03D (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0009
Current Value: 0009
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 1C 00 00 00 02 00 14 10 C8 01 00 00 41 D0 04 00
0010: 01 01 00 01 00 02 02 00 01 00 00 00
 
Device Property: D041 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0001
Current Value: 0001
Enumeration: {0001, 0000}
 
0000: 18 00 00 00 02 00 14 10 CA 01 00 00 42 D0 04 00
0010: 00 02 00 02 00 02 00 00
 
Device Property: D042 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0002
Current Value: 0002
Enumeration: {}
 
0000: 16 00 00 00 02 00 14 10 CC 01 00 00 43 D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D043 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: 1C 00 00 00 02 00 14 10 CE 01 00 00 44 D0 04 00
0010: 01 00 00 00 00 02 02 00 00 00 01 00
 
Device Property: D044 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0000
Current Value: 0000
Enumeration: {0000, 0001}
 
0000: 26 00 00 00 02 00 14 10 D0 01 00 00 45 D0 04 00
0010: 01 02 00 04 00 02 07 00 01 00 02 00 03 00 04 00
0020: 05 00 06 00 07 00
 
Device Property: D045 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0002
Current Value: 0004
Enumeration: {0001, 0002, 0003, 0004, 0005, 0006, 0007}
 
0000: 16 00 00 00 02 00 14 10 D2 01 00 00 46 D0 04 00
0010: 00 01 01 01 01 00
 
Device Property: D046 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0101
Current Value: 0101
 
0000: 16 00 00 00 02 00 14 10 D4 01 00 00 47 D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D047 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: B2 00 00 00 02 00 14 10 D6 01 00 00 48 D0 06 40
0010: 00 13 00 00 00 00 10 40 00 00 80 2A 00 00 48 1F
0020: 00 00 00 00 00 00 E4 03 00 00 70 26 00 00 50 19
0030: 00 00 70 11 00 00 00 00 00 00 58 02 00 00 48 12
0040: 00 00 30 0C 00 00 B0 08 00 00 00 00 00 00 50 01
0050: 00 00 00 00 00 00 A8 0F 00 00 B8 08 00 00 58 04
0060: 00 13 00 00 00 00 10 40 00 00 80 2A 00 00 48 1F
0070: 00 00 00 00 00 00 E4 03 00 00 70 26 00 00 50 19
0080: 00 00 70 11 00 00 00 00 00 00 58 02 00 00 48 12
0090: 00 00 30 0C 00 00 B0 08 00 00 00 00 00 00 50 01
00A0: 00 00 00 00 00 00 A8 0F 00 00 B8 08 00 00 58 04
00B0: 00 00
 
Device Property: D048 (Vendor defined)
Data Type: AUINT32
Get/Set: Get
Default Value: 00401000,002A8000,001F4800,00000000,0003E400,00267000,00195000,00117000,00000000,00025800,00124800,000C3000,0008B000,00000000,00015000,00000000,000FA800,0008B800,00045800
Current Value: 00401000,002A8000,001F4800,00000000,0003E400,00267000,00195000,00117000,00000000,00025800,00124800,000C3000,0008B000,00000000,00015000,00000000,000FA800,0008B800,00045800
 
0000: 1A 00 00 00 02 00 14 10 D8 01 00 00 49 D0 06 00
0010: 00 00 00 03 02 00 00 03 02 00
 
Device Property: D049 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 02030000
Current Value: 02030000
 
0000: 1A 00 00 00 02 00 14 10 DA 01 00 00 4A D0 02 00
0010: 01 00 00 02 04 00 00 01 02 03
 
Device Property: D04A (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
Enumeration: {00, 01, 02, 03}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
 
Mode:M
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 24 00 00 00 02 00 14 10 15 02 00 00 02 D0 04 00
0010: 00 00 00 00 00 02 06 00 00 00 01 00 02 00 03 00
0020: 04 00 05 00
 
Device Property: D002 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
Enumeration: {0000, 0001, 0002, 0003, 0004, 0005}
 
0000: 2C 00 00 00 02 00 14 10 17 02 00 00 03 D0 06 00
0010: 00 01 00 00 00 01 00 00 00 02 04 00 00 00 00 00
0020: 01 00 00 00 02 00 00 00 03 00 00 00
 
Device Property: D003 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00000001
Current Value: 00000001
Enumeration: {00000000, 00000001, 00000002, 00000003}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 19 00 00 00 02 00 14 10 1B 02 00 00 06 D0 02 00
0010: 01 05 05 02 03 00 05 03 02
 
Device Property: D006 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 05
Current Value: 05
Enumeration: {05, 03, 02}
 
0000: 16 00 00 00 02 00 14 10 1D 02 00 00 07 D0 02 00
0010: 00 01 01 02 00 00
 
Device Property: D007 (Vendor defined)
Data Type: UINT8
Get/Set: Get
Default Value: 01
Current Value: 01
Enumeration: {}
 
0000: 1B 00 00 00 02 00 14 10 1F 02 00 00 08 D0 02 00
0010: 01 00 00 02 05 00 00 01 03 07 02
 
Device Property: D008 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
Enumeration: {00, 01, 03, 07, 02}
 
Transaction: Response recieve error: 2006
0000: 19 00 00 00 02 00 14 10 22 02 00 00 0A D0 02 00
0010: 01 02 02 02 03 00 00 02 06
 
Device Property: D00A (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 02
Current Value: 02
Enumeration: {00, 02, 06}
 
Transaction: Response recieve error: 2006
0000: 1A 00 00 00 02 00 14 10 25 02 00 00 0C D0 02 00
0010: 01 01 04 02 04 00 01 02 03 04
 
Device Property: D00C (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 01
Current Value: 04
Enumeration: {01, 02, 03, 04}
 
Transaction: Response recieve error: 2006
0000: 16 00 00 00 02 00 14 10 28 02 00 00 0E D0 02 00
0010: 00 00 00 02 00 00
 
Device Property: D00E (Vendor defined)
Data Type: UINT8
Get/Set: Get
Default Value: 00
Current Value: 00
Enumeration: {}
 
Transaction: Response recieve error: 2006
0000: 19 00 00 00 02 00 14 10 2B 02 00 00 10 D0 02 00
0010: 01 03 03 02 03 00 03 00 01
 
Device Property: D010 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 03
Current Value: 03
Enumeration: {03, 00, 01}
 
0000: 18 00 00 00 02 00 14 10 2D 02 00 00 11 D0 02 00
0010: 01 01 01 02 02 00 01 03
 
Device Property: D011 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 01
Current Value: 01
Enumeration: {01, 03}
 
0000: 1C 00 00 00 02 00 14 10 2F 02 00 00 12 D0 04 00
0010: 01 01 30 01 30 02 02 00 01 30 03 30
 
Device Property: D012 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 3001
Current Value: 3001
Enumeration: {3001, 3003}
 
0000: 1D 00 00 00 02 00 14 10 31 02 00 00 13 D0 02 00
0010: 01 00 00 02 07 00 00 01 02 03 04 07 06
 
Device Property: D013 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
Enumeration: {00, 01, 02, 03, 04, 07, 06}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 22 00 00 00 02 00 14 10 3B 02 00 00 1C D0 04 00
0010: 01 48 00 48 00 02 05 00 45 00 48 00 50 00 58 00
0020: 60 00
 
Device Property: D01C (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0048
Current Value: 0048
Enumeration: {0045, 0048, 0050, 0058, 0060}
 
0000: 2C 00 00 00 02 00 14 10 3D 02 00 00 1D D0 04 00
0010: 01 28 00 28 00 02 0A 00 20 00 23 00 25 00 28 00
0020: 2B 00 2D 00 30 00 33 00 35 00 38 00
 
Device Property: D01D (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0028
Current Value: 0028
Enumeration: {0020, 0023, 0025, 0028, 002B, 002D, 0030, 0033, 0035, 0038}
 
0000: 72 00 00 00 02 00 14 10 3F 02 00 00 1E D0 04 00
0010: 01 60 00 60 00 02 2D 00 18 00 1B 00 1D 00 20 00
0020: 23 00 25 00 28 00 2B 00 2D 00 30 00 33 00 35 00
0030: 38 00 3B 00 3D 00 40 00 43 00 45 00 48 00 4B 00
0040: 4D 00 50 00 53 00 55 00 58 00 5B 00 5D 00 60 00
0050: 63 00 65 00 68 00 6B 00 6D 00 70 00 73 00 75 00
0060: 78 00 7B 00 7D 00 80 00 83 00 85 00 88 00 8B 00
0070: 8D 00
 
Device Property: D01E (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0060
Current Value: 0060
Enumeration: {0018, 001B, 001D, 0020, 0023, 0025, 0028, 002B, 002D, 0030, 0033, 0035, 0038, 003B, 003D, 0040, 0043, 0045, 0048, 004B, 004D, 0050, 0053, 0055, 0058, 005B, 005D, 0060, 0063, 0065, 0068, 006B, 006D, 0070, 0073, 0075, 0078, 007B, 007D, 0080, 0083, 0085, 0088, 008B, 008D}
 
0000: 16 00 00 00 02 00 14 10 41 02 00 00 1F D0 02 00
0010: 00 18 18 02 00 00
 
Device Property: D01F (Vendor defined)
Data Type: UINT8
Get/Set: Get
Default Value: 18
Current Value: 18
Enumeration: {}
 
0000: 16 00 00 00 02 00 14 10 43 02 00 00 20 D0 02 00
0010: 00 18 18 02 00 00
 
Device Property: D020 (Vendor defined)
Data Type: UINT8
Get/Set: Get
Default Value: 18
Current Value: 18
Enumeration: {}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 2E 00 00 00 02 00 14 10 4D 02 00 00 29 D0 04 00
0010: 01 03 00 03 00 02 0B 00 01 00 02 00 03 00 08 00
0020: 09 00 0A 00 0B 00 0C 00 0D 00 0E 00 0F 00
 
Device Property: D029 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0003
Current Value: 0003
Enumeration: {0001, 0002, 0003, 0008, 0009, 000A, 000B, 000C, 000D, 000E, 000F}
 
0000: 1C 00 00 00 02 00 14 10 4F 02 00 00 2A D0 04 00
0010: 01 00 00 00 00 01 00 00 0E 00 01 00
 
Device Property: D02A (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0000
Current Value: 0000
Range (Min,Max,Step): {0000, 000E, 0001}
 
Transaction: Response recieve error: 2006
0000: F0 01 00 00 02 00 14 10 52 02 00 00 2C D0 06 40
0010: 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0040: 00 00 00 00 00 00 00 00 00 02 0F 00 06 00 00 00
0050: B0 0A 00 00 40 0E 00 00 01 00 00 00 00 00 00 00
0060: 00 00 00 00 00 00 00 00 06 00 00 00 B0 0A 00 00
0070: 40 0E 00 00 06 00 00 00 00 00 00 00 00 00 00 00
0080: 00 00 00 00 06 00 00 00 B0 0A 00 00 40 0E 00 00
0090: 0B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00A0: 06 00 00 00 40 08 00 00 00 0B 00 00 02 00 00 00
00B0: 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00
00C0: 40 08 00 00 00 0B 00 00 07 00 00 00 00 00 00 00
00D0: 00 00 00 00 00 00 00 00 06 00 00 00 40 08 00 00
00E0: 00 0B 00 00 0C 00 00 00 00 00 00 00 00 00 00 00
00F0: 00 00 00 00 06 00 00 00 A8 06 00 00 E0 08 00 00
0100: 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0110: 06 00 00 00 A8 06 00 00 E0 08 00 00 08 00 00 00
0120: 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00
0130: A8 06 00 00 E0 08 00 00 0D 00 00 00 00 00 00 00
0140: 00 00 00 00 00 00 00 00 06 00 00 00 B0 04 00 00
0150: 40 06 00 00 11 00 00 00 00 00 00 00 00 00 00 00
0160: 00 00 00 00 06 00 00 00 B0 04 00 00 40 06 00 00
0170: 12 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0180: 06 00 00 00 B0 04 00 00 40 06 00 00 13 00 00 00
0190: 00 00 00 00 00 00 00 00 00 00 00 00 06 00 00 00
01A0: E0 01 00 00 80 02 00 00 05 00 00 00 00 00 00 00
01B0: 00 00 00 00 00 00 00 00 06 00 00 00 E0 01 00 00
01C0: 80 02 00 00 0A 00 00 00 00 00 00 00 00 00 00 00
01D0: 00 00 00 00 06 00 00 00 E0 01 00 00 80 02 00 00
01E0: 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 
 
Device Property: D02C (Vendor defined)
Data Type: AUINT32
Get/Set: Get
Default Value: 00000000,00000000,00000000,00000000,00000000,00000000
Current Value: 00000000,00000000,00000000,00000000,00000000,00000000
Enumeration: {00000AB0, 00000E40, 00000001, 00000000, 00000000, 0000000000000B00, 00000007, 00000000, 00000000, 00000000, 00000006, 00000840, 00000B00, 0000000C, 00000000, 00000000, 00000000, 00000006, 000006A8, 000008E0, 00000003, 00000000, 00000000, 00000000, 00000006, 000006A8, 000008E0, 00000008, 00000000, 00000000, 00000000, 00000006, 000006A8, 000008E0, 0000000D, 00000000, 00000000, 00000000, 00000006, 000004B0, 00000640, 00000011, 00000000, 00000000, 00000000, 00000006, 000004B0, 00000640, 00000012, 00000000, 00000000, 00000000, 00000006, 000004B0, 00000640, 00000013, 00000000, 00000000, 00000000, 00000006, 000001E0, 00000280, 00000005, 00000000, 00000000, 00000000, 00000006, 000001E0, 00000280, 0000000A, 00000000, 00000000, 00000000, 00000006, 000001E0, 00000280, 0000000F, 00000000, 00000000, 00000000
0000: 3A 00 00 00 02 00 14 10 54 02 00 00 2D D0 06 40
0010: 00 04 00 00 00 77 00 00 00 00 00 00 00 9F 00 00
0020: 00 00 00 00 00 04 00 00 00 77 00 00 00 00 00 00
0030: 00 9F 00 00 00 00 00 00 00 00
 
Device Property: D02D (Vendor defined)
Data Type: AUINT32
Get/Set: Get
Default Value: 00000077,00000000,0000009F,00000000
Current Value: 00000077,00000000,0000009F,00000000
 
0000: 1A 00 00 00 02 00 14 10 56 02 00 00 2E D0 06 00
0010: 00 00 00 08 00 00 00 08 00 00
 
Device Property: D02E (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00080000
Current Value: 00080000
 
0000: 1A 00 00 00 02 00 14 10 58 02 00 00 2F D0 06 00
0010: 00 00 00 04 00 00 00 04 00 00
 
Device Property: D02F (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00040000
Current Value: 00040000
 
0000: 1A 00 00 00 02 00 14 10 5A 02 00 00 30 D0 06 00
0010: 00 00 01 00 00 00 01 00 00 00
 
Device Property: D030 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 00000100
Current Value: 00000100
 
0000: 1A 00 00 00 02 00 14 10 5C 02 00 00 31 D0 06 00
0010: 00 00 00 00 01 00 00 00 01 00
 
Device Property: D031 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 01000000
Current Value: 01000000
 
0000: 68 00 00 00 02 00 14 10 5E 02 00 00 32 D0 FF FF
0010: 00 15 43 00 61 00 6E 00 6F 00 6E 00 20 00 50 00
0020: 6F 00 77 00 65 00 72 00 53 00 68 00 6F 00 74 00
0030: 20 00 41 00 36 00 34 00 30 00 00 00 15 43 00 61
0040: 00 6E 00 6F 00 6E 00 20 00 50 00 6F 00 77 00 65
0050: 00 72 00 53 00 68 00 6F 00 74 00 20 00 41 00 36
0060: 00 34 00 30 00 00 00 00
 
Device Property: D032 (Vendor defined)
Data Type: STR
Get/Set: Get
Default Value: Canon PowerShot A640
Current Value: Canon PowerShot A640
 
0000: 1C 00 00 00 02 00 14 10 60 02 00 00 33 D0 02 40
0010: 01 01 00 00 00 00 01 00 00 00 00 00
 
Device Property: D033 (Vendor defined)
Data Type: AUINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
 
0000: 1A 00 00 00 02 00 14 10 62 02 00 00 34 D0 06 00
0010: 01 F1 F7 30 4D F1 F7 30 4D 00
 
Device Property: D034 (Vendor defined)
Data Type: UINT32
Get/Set: Get/Set
Default Value: 4D30F7F1
Current Value: 4D30F7F1
 
Transaction: Response recieve error: 2006
0000: 19 00 00 00 02 00 14 10 65 02 00 00 36 D0 02 00
0010: 01 03 03 02 03 00 01 02 03
 
Device Property: D036 (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 03
Current Value: 03
Enumeration: {01, 02, 03}
 
0000: 16 00 00 00 02 00 14 10 67 02 00 00 37 D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D037 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: 16 00 00 00 02 00 14 10 69 02 00 00 38 D0 04 00
0010: 00 20 00 20 00 00
 
Device Property: D038 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0020
Current Value: 0020
 
0000: 16 00 00 00 02 00 14 10 6B 02 00 00 39 D0 04 00
0010: 00 40 0E 40 0E 00
 
Device Property: D039 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0E40
Current Value: 0E40
 
Transaction: Response recieve error: 2006
0000: 16 00 00 00 02 00 14 10 6E 02 00 00 3B D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D03B (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: 16 00 00 00 02 00 14 10 70 02 00 00 3C D0 04 00
0010: 00 38 00 38 00 00
 
Device Property: D03C (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0038
Current Value: 0038
 
0000: 16 00 00 00 02 00 14 10 72 02 00 00 3D D0 04 00
0010: 00 09 00 09 00 00
 
Device Property: D03D (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0009
Current Value: 0009
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
0000: 1C 00 00 00 02 00 14 10 77 02 00 00 41 D0 04 00
0010: 01 01 00 01 00 02 02 00 01 00 00 00
 
Device Property: D041 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0001
Current Value: 0001
Enumeration: {0001, 0000}
 
0000: 1E 00 00 00 02 00 14 10 79 02 00 00 42 D0 04 00
0010: 01 00 00 00 00 02 03 00 02 00 01 00 00 00
 
Device Property: D042 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0000
Current Value: 0000
Enumeration: {0002, 0001, 0000}
 
0000: 16 00 00 00 02 00 14 10 7B 02 00 00 43 D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D043 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: 1C 00 00 00 02 00 14 10 7D 02 00 00 44 D0 04 00
0010: 01 00 00 00 00 02 02 00 00 00 01 00
 
Device Property: D044 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0000
Current Value: 0000
Enumeration: {0000, 0001}
 
0000: 26 00 00 00 02 00 14 10 7F 02 00 00 45 D0 04 00
0010: 01 02 00 04 00 02 07 00 01 00 02 00 03 00 04 00
0020: 05 00 06 00 07 00
 
Device Property: D045 (Vendor defined)
Data Type: UINT16
Get/Set: Get/Set
Default Value: 0002
Current Value: 0004
Enumeration: {0001, 0002, 0003, 0004, 0005, 0006, 0007}
 
0000: 16 00 00 00 02 00 14 10 81 02 00 00 46 D0 04 00
0010: 00 01 01 01 01 00
 
Device Property: D046 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0101
Current Value: 0101
 
0000: 16 00 00 00 02 00 14 10 83 02 00 00 47 D0 04 00
0010: 00 00 00 00 00 00
 
Device Property: D047 (Vendor defined)
Data Type: UINT16
Get/Set: Get
Default Value: 0000
Current Value: 0000
 
0000: B2 00 00 00 02 00 14 10 85 02 00 00 48 D0 06 40
0010: 00 13 00 00 00 00 10 40 00 00 80 2A 00 00 48 1F
0020: 00 00 00 00 00 00 E4 03 00 00 70 26 00 00 50 19
0030: 00 00 70 11 00 00 00 00 00 00 58 02 00 00 48 12
0040: 00 00 30 0C 00 00 B0 08 00 00 00 00 00 00 50 01
0050: 00 00 00 00 00 00 A8 0F 00 00 B8 08 00 00 58 04
0060: 00 13 00 00 00 00 10 40 00 00 80 2A 00 00 48 1F
0070: 00 00 00 00 00 00 E4 03 00 00 70 26 00 00 50 19
0080: 00 00 70 11 00 00 00 00 00 00 58 02 00 00 48 12
0090: 00 00 30 0C 00 00 B0 08 00 00 00 00 00 00 50 01
00A0: 00 00 00 00 00 00 A8 0F 00 00 B8 08 00 00 58 04
00B0: 00 00
 
Device Property: D048 (Vendor defined)
Data Type: AUINT32
Get/Set: Get
Default Value: 00401000,002A8000,001F4800,00000000,0003E400,00267000,00195000,00117000,00000000,00025800,00124800,000C3000,0008B000,00000000,00015000,00000000,000FA800,0008B800,00045800
Current Value: 00401000,002A8000,001F4800,00000000,0003E400,00267000,00195000,00117000,00000000,00025800,00124800,000C3000,0008B000,00000000,00015000,00000000,000FA800,0008B800,00045800
 
0000: 1A 00 00 00 02 00 14 10 87 02 00 00 49 D0 06 00
0010: 00 00 00 03 02 00 00 03 02 00
 
Device Property: D049 (Vendor defined)
Data Type: UINT32
Get/Set: Get
Default Value: 02030000
Current Value: 02030000
 
0000: 1A 00 00 00 02 00 14 10 89 02 00 00 4A D0 02 00
0010: 01 00 00 02 04 00 00 01 02 03
 
Device Property: D04A (Vendor defined)
Data Type: UINT8
Get/Set: Get/Set
Default Value: 00
Current Value: 00
Enumeration: {00, 01, 02, 03}
 
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
Transaction: Response recieve error: 2006
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSRemote/PSRemote.pde
0,0 → 1,110
/* Canon Powershot control terminal */
//#include <Spi.h>
#include <Max3421e.h>
#include <Usb.h>
#include <simpletimer.h>
#include <ptp.h>
#include <canonps.h>
#include <qep_port.h>
#include <valuelist.h>
#include <psvaluetitles.h>
 
#include "ptpdpparser.h"
#include "ptpobjinfoparser.h"
#include "pseventparser.h"
#include "psconsole.h"
 
#define DEV_ADDR 1
 
// Canon PowerShot S3 IS
#define DATA_IN_EP 1
#define DATA_OUT_EP 2
#define INTERRUPT_EP 3
#define CONFIG_NUM 1
 
class CamStateHandlers : public PSStateHandlers
{
enum CamStates { stInitial, stDisconnected, stConnected };
CamStates stateConnected;
public:
CamStateHandlers() : stateConnected(stInitial)
{
};
virtual void OnDeviceDisconnectedState(PTP *ptp);
virtual void OnDeviceInitializedState(PTP *ptp);
};
 
CamStateHandlers CamStates;
SimpleTimer ControlTimer, PTPPollTimer;
 
CanonPS Ps(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);
QEvent evtTick, evtAbort;
PSConsole psConsole;
 
void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
{
if (stateConnected == stConnected || stateConnected == stInitial)
{
stateConnected = stDisconnected;
PTPPollTimer.Disable();
Notify(PSTR("Camera disconnected.\r\n"));
if (stateConnected == stConnected)
psConsole.dispatch(&evtTick);
}
}
 
void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
{
if (stateConnected == stDisconnected || stateConnected == stInitial)
{
stateConnected = stConnected;
PTPPollTimer.Enable();
psConsole.dispatch(&evtTick);
}
int8_t index = psConsole.MenuSelect();
if (index >= 0)
{
MenuSelectEvt menu_sel_evt;
menu_sel_evt.sig = MENU_SELECT_SIG;
menu_sel_evt.item_index = index;
psConsole.dispatch(&menu_sel_evt); // dispatch the event
}
}
 
void OnPTPPollTimer()
{
PSEventParser prs;
Ps.EventCheck(&prs);
if (uint32_t handle = prs.GetObjHandle())
{
PTPObjInfoParser inf;
Ps.GetObjectInfo(handle, &inf);
}
}
 
void setup()
{
Serial.begin(115200);
Ps.Setup();
delay( 200 );
PTPPollTimer.Set(OnPTPPollTimer, 300);
evtTick.sig = TICK_SIG;
// evtAbort.sig = ABORT_SIG;
psConsole.init();
 
Serial.println("Start");
}
 
void loop()
{
Ps.Task();
PTPPollTimer.Run();
}
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSRemote/psconsole.cpp
0,0 → 1,475
#include "psconsole.h"
#include <psvaluetitles.h>
#include <valuelist.h>
 
extern CanonPS Ps;
 
/* fixes avr-gcc incompatibility with virtual destructors */
void operator delete( void *p ) {}
 
const char* menuMain[] = {"Capture", "View Settings", "Change Settings", "Viewfinder On", "Viewfinder Off"};
const char* menuChangeSettings[] = {"Mode", "Aperture", "Shutter Speed", "WB", "ISO", "Exp Comp", "CamOutput", "Zoom"};
const char* menuUpDown[] = {"<<", ">>"};
 
#define MAIN_MENU_COUNT sizeof(menuMain) / sizeof(const char*)
#define CHSET_MENU_COUNT sizeof(menuChangeSettings) / sizeof(const char*)
#define UPDWN_MENU_COUNT sizeof(menuUpDown) / sizeof(const char*)
 
void PrintMode()
{
Notify(PSTR("Mode:"));
PrintValueTitle<uint8_t, VT_MODE, VT_MODE_COUNT, VT_MODE_TEXT_LEN>((PTP*)&Ps, PS_DPC_ShootingMode, ModeTitles);
Notify(PSTR("\r\n"));
}
 
void PrintAperture()
{
Notify(PSTR("F:"));
PrintValueTitle<uint16_t, VT_APERTURE, VT_APT_COUNT, VT_APT_TEXT_LEN>((PTP*)&Ps, PS_DPC_Aperture, ApertureTitles);
Notify(PSTR("\r\n"));
}
 
void PrintShutterSpeed()
{
Notify(PSTR("T:"));
PrintValueTitle<uint16_t, VT_SHSPEED, VT_SHSPEED_COUNT, VT_SHSPEED_TEXT_LEN>((PTP*)&Ps, PS_DPC_ShutterSpeed, ShutterSpeedTitles);
Notify(PSTR("\r\n"));
}
 
void PrintWB()
{
Notify(PSTR("WB:"));
PrintValueTitle<uint8_t, VT_WB, VT_WB_COUNT, VT_WB_TEXT_LEN>((PTP*)&Ps, PS_DPC_WhiteBalance, WbTitles);
Notify(PSTR("\r\n"));
}
 
void PrintIso()
{
Notify(PSTR("ISO:"));
PrintValueTitle<uint16_t, VT_ISO, VT_ISO_COUNT, VT_ISO_TEXT_LEN>((PTP*)&Ps, PS_DPC_ISOSpeed, IsoTitles);
Notify(PSTR("\r\n"));
}
 
void PrintExpCompensation()
{
Notify(PSTR("ExpComp:"));
PrintValueTitle<uint8_t, VT_EXPCOMP, VT_EXPCOMP_COUNT, VT_EXPCOMP_TEXT_LEN>((PTP*)&Ps, PS_DPC_ExpCompensation, ExpCompTitles);
Notify(PSTR("\r\n"));
}
 
void PrintCamOutput()
{
Notify(PSTR("CamOutput:"));
PrintValueTitle<uint8_t, VT_CAMOUTPUT, VT_CAMOUTPUT_COUNT, VT_CAMOUTPUT_TEXT_LEN>((PTP*)&Ps, PS_DPC_CameraOutput, CamOutputTitles);
Notify(PSTR("\r\n"));
}
 
void PrintZoom()
{
uint16_t val = 0;
Notify(PSTR("Zoom:"));
if (Ps.GetDevicePropValue(PS_DPC_Zoom, (uint16_t&)val) == PTP_RC_OK)
PrintHex<uint16_t>(val);
Notify(PSTR("\r\n"));
}
 
void PSConsole::ShowParams()
{
PrintMode();
PrintAperture();
PrintShutterSpeed();
PrintWB();
PrintIso();
PrintExpCompensation();
PrintCamOutput();
PrintZoom();
}
 
QState PSConsole::Initial(PSConsole *me, QEvent const *e)
{
return Q_TRAN(&PSConsole::Inactive);
}
 
QState PSConsole::Inactive(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
Notify(PSTR("Inactive\r\n"));
return Q_HANDLED();
case TICK_SIG:
return Q_TRAN(&PSConsole::Active);
}
return Q_SUPER(QHsm::top);
}
 
QState PSConsole::Active(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
Notify(PSTR("Active\r\n"));
return Q_HANDLED();
case Q_INIT_SIG:
return Q_TRAN(&PSConsole::MainMenu);
case TICK_SIG:
return Q_TRAN(&PSConsole::Inactive);
}
return Q_SUPER(QHsm::top);
}
 
void PSConsole::PrintMenuTitles(uint8_t count, const char **menu)
{
Serial.println("");
for (uint8_t i=0; i<=count; i++)
{
Serial.print(i, DEC);
Serial.print(". ");
if (i == 0)
Serial.println("<..>");
else
Serial.println(menu[i-1]);
}
Serial.println("");
}
 
QState PSConsole::MainMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(MAIN_MENU_COUNT, menuMain);
return Q_HANDLED();
case MENU_SELECT_SIG:
{
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
PrintMenuTitles(MAIN_MENU_COUNT, menuMain);
return Q_HANDLED();
case 1:
Ps.SetDevicePropValue(PS_DPC_CaptureTransferMode, (uint16_t)0x0D);
Ps.Capture();
return Q_HANDLED();
case 2:
ShowParams();
PrintMenuTitles(MAIN_MENU_COUNT, menuMain);
return Q_HANDLED();
case 3:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 4:
Ps.Operation(PS_OC_ViewfinderOn);
return Q_HANDLED();
case 5:
Ps.Operation(PS_OC_ViewfinderOff);
return Q_HANDLED();
}
}
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeSettingsMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(CHSET_MENU_COUNT, menuChangeSettings);
return Q_HANDLED();
case MENU_SELECT_SIG:
{
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::MainMenu);
case 1: // Aperture
return Q_TRAN(&PSConsole::ChangeModeMenu);
case 2: // Aperture
return Q_TRAN(&PSConsole::ChangeApertureMenu);
case 3: // Shutter Speed
return Q_TRAN(&PSConsole::ChangeShutterSpeedMenu);
case 4: // White Balance
return Q_TRAN(&PSConsole::ChangeWBMenu);
case 5: // ISO
return Q_TRAN(&PSConsole::ChangeIsoMenu);
case 6: // Exposure Compensation
return Q_TRAN(&PSConsole::ChangeExpCompMenu);
case 7: // Camera Output
return Q_TRAN(&PSConsole::ChangeCamOutputMenu);
case 8: // Zoom
return Q_TRAN(&PSConsole::ChangeZoomMenu);
} // switch
}
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeModeMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintMode();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 2:
StepUp<uint8_t>((PTP*)&Ps, PS_DPC_ShootingMode);
PrintMode();
return Q_HANDLED();
case 1:
StepDown<uint8_t>((PTP*)&Ps, PS_DPC_ShootingMode);
PrintMode();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeApertureMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintAperture();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 2:
StepUp<uint16_t>((PTP*)&Ps, PS_DPC_Aperture);
PrintAperture();
return Q_HANDLED();
case 1:
StepDown<uint16_t>((PTP*)&Ps, PS_DPC_Aperture);
PrintAperture();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeShutterSpeedMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintShutterSpeed();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 2:
StepUp<uint16_t>((PTP*)&Ps, PS_DPC_ShutterSpeed);
PrintShutterSpeed();
return Q_HANDLED();
case 1:
StepDown<uint16_t>((PTP*)&Ps, PS_DPC_ShutterSpeed);
PrintShutterSpeed();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeWBMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintWB();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 2:
StepUp<uint8_t>((PTP*)&Ps, PS_DPC_WhiteBalance);
PrintWB();
return Q_HANDLED();
case 1:
StepDown<uint8_t>((PTP*)&Ps, PS_DPC_WhiteBalance);
PrintWB();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeIsoMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintIso();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 2:
StepUp<uint16_t>((PTP*)&Ps, PS_DPC_ISOSpeed);
PrintIso();
return Q_HANDLED();
case 1:
StepDown<uint16_t>((PTP*)&Ps, PS_DPC_ISOSpeed);
PrintIso();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeExpCompMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintExpCompensation();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 1:
StepUp<uint8_t>((PTP*)&Ps, PS_DPC_ExpCompensation);
PrintExpCompensation();
return Q_HANDLED();
case 2:
StepDown<uint8_t>((PTP*)&Ps, PS_DPC_ExpCompensation);
PrintExpCompensation();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeCamOutputMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintCamOutput();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 2:
StepUp<uint8_t>((PTP*)&Ps, PS_DPC_CameraOutput);
PrintCamOutput();
return Q_HANDLED();
case 1:
StepDown<uint8_t>((PTP*)&Ps, PS_DPC_CameraOutput);
PrintCamOutput();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeZoomMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintZoom();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 2:
StepUp<uint16_t>((PTP*)&Ps, PS_DPC_Zoom);
PrintZoom();
return Q_HANDLED();
case 1:
StepDown<uint16_t>((PTP*)&Ps, PS_DPC_Zoom);
PrintZoom();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
static TickEvt tick_evt;
 
int8_t PSConsole::MenuSelect()
{
if( !Serial.available())
return -1;
uint8_t char_count = 0;
uint8_t index = 0;
while (Serial.available() > 0 && char_count < 2)
{
uint8_t key = Serial.read();
key -= '0';
if (index)
{
uint8_t tmp = index;
// index *= 10;
index <<= 3;
index += tmp;
index += tmp;
}
index += key;
char_count ++;
}
return (char_count) ? (int8_t)index : (int8_t)-1;
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSRemote/psconsole.h
0,0 → 1,56
#if !defined(__PSCONSOLE_H__)
#define __PSCONSOLE_H__
 
#include <inttypes.h>
#include <avr/pgmspace.h>
#include <qep_port.h>
#include <WProgram.h>
#include <canonps.h>
 
#include "ptpdpparser.h"
 
enum TextMenuSignals
{
MENU_SELECT_SIG = Q_USER_SIG,
TICK_SIG
};
 
struct TickEvt : public QEvent
{
uint8_t fine_time; // the fine 1/10 s counter
};
 
struct MenuSelectEvt : public QEvent
{
uint8_t item_index;
};
 
class PSConsole : public QHsm
{
static void PrintMenuTitles(uint8_t count, const char **menu);
static void ShowParams();
public:
PSConsole()
: QHsm((QStateHandler)&PSConsole::Initial)
{};
int8_t MenuSelect();
 
protected:
static QState Initial(PSConsole *me, QEvent const *e);
static QState Inactive(PSConsole *me, QEvent const *e);
static QState Active(PSConsole *me, QEvent const *e);
static QState MainMenu(PSConsole *me, QEvent const *e);
static QState ChangeSettingsMenu(PSConsole *me, QEvent const *e);
static QState ChangeModeMenu(PSConsole *me, QEvent const *e);
static QState ChangeApertureMenu(PSConsole *me, QEvent const *e);
static QState ChangeShutterSpeedMenu(PSConsole *me, QEvent const *e);
static QState ChangeWBMenu(PSConsole *me, QEvent const *e);
static QState ChangeImageModeMenu(PSConsole *me, QEvent const *e);
static QState ChangeExpCompMenu(PSConsole *me, QEvent const *e);
static QState ChangeIsoMenu(PSConsole *me, QEvent const *e);
static QState ChangeCamOutputMenu(PSConsole *me, QEvent const *e);
static QState ChangeZoomMenu(PSConsole *me, QEvent const *e);
};
 
#endif // __PSCONSOLE_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSRemote/pseventparser.cpp
0,0 → 1,85
#include "pseventparser.h"
 
void PSEventParser::Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset)
{
uint16_t cntdn = (uint16_t)len;
uint8_t *p = (uint8_t*)pbuf;
 
switch (nStage)
{
case 0:
p += 12;
cntdn -= 12;
 
if (!cntdn)
return;
nStage ++;
 
case 1:
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 2:
if (!valueParser.Parse(&p, &cntdn))
return;
 
//PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 3:
//Notify(PSTR("\r\nNumber of Fields:\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 4:
if (!valueParser.Parse(&p, &cntdn))
return;
 
//PrintHex<uint16_t>(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 5:
//Notify(PSTR("\r\nEvent Code:\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 6:
if (!valueParser.Parse(&p, &cntdn))
return;
 
eventCode = *((uint16_t*)theBuffer.pValue);
//PrintHex<uint16_t>(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 7:
//Notify(PSTR("\r\nTransaction ID:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 8:
if (!valueParser.Parse(&p, &cntdn))
return;
 
//PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 9:
if (eventCode == PTP_EC_ObjectAdded)
Notify(PSTR("\r\nObject Added:\t\t"));
 
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 10:
if (eventCode == PTP_EC_ObjectAdded)
{
if (!valueParser.Parse(&p, &cntdn))
return;
 
objHandle = *((uint32_t*)theBuffer.pValue);
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
Notify(PSTR("\r\n"));
}
if (eventCode == PTP_EC_CaptureComplete)
Notify(PSTR("\r\nCapture complete.\r\n"));
nStage ++;
case 11:
nStage = 0;
}
}
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSRemote/pseventparser.h
0,0 → 1,29
#ifndef __PSEVENTPARSER_H__
#define __PSEVENTPARSER_H__
 
#include <inttypes.h>
#include <avr/pgmspace.h>
#include "ptpcallback.h"
#include "ptpdebug.h"
#include "canonps.h"
 
class PSEventParser : public PTPReadParser
{
MultiValueBuffer theBuffer;
uint32_t varBuffer;
uint8_t nStage;
uint16_t eventCode;
uint32_t objHandle;
 
MultiByteValueParser valueParser;
 
public:
PSEventParser() : nStage(0), varBuffer(0), objHandle(0)
{
theBuffer.pValue = &varBuffer;
};
uint32_t GetObjHandle() { return objHandle; };
virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset);
};
 
#endif // __PSEVENTPARSER_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSRemote/ptpobjinfoparser.cpp
0,0 → 1,298
#include "ptpobjinfoparser.h"
 
const char* PTPObjInfoParser::acNames[] PROGMEM =
{
msgUndefined,
msgAssociation,
msgScript,
msgExecutable,
msgText,
msgHTML,
msgDPOF,
msgAIFF,
msgWAV,
msgMP3,
msgAVI,
msgMPEG,
msgASF,
msgQT
};
 
const char* PTPObjInfoParser::imNames[] PROGMEM =
{
msgUndefined,
msgEXIF_JPEG,
msgTIFF_EP,
msgFlashPix,
msgBMP,
msgCIFF,
msgUndefined_0x3806,
msgGIF,
msgJFIF,
msgPCD,
msgPICT,
msgPNG,
msgUndefined_0x380C,
msgTIFF,
msgTIFF_IT,
msgJP2,
msgJPX,
};
 
void PTPObjInfoParser::PrintFormat(uint16_t op)
{
Serial.print(op, HEX);
Serial.print("\t");
//Notify(msgTab);
 
if ((((op >> 8) & 0xFF) == 0x30) && ((op & 0xFF) <= (PTP_OFC_QT & 0xFF)))
Notify((char*)pgm_read_word(&acNames[(op & 0xFF)]));
else
if ((((op >> 8) & 0xFF) == 0x38) && ((op & 0xFF) <= (PTP_OFC_JPX & 0xFF)))
Notify((char*)pgm_read_word(&imNames[(op & 0xFF)]));
else
{
switch (op)
{
case MTP_OFC_Undefined_Firmware:
Notify(msgUndefined_Firmware);
break;
case MTP_OFC_Windows_Image_Format:
Notify(msgWindows_Image_Format);
break;
case MTP_OFC_Undefined_Audio:
Notify(msgUndefined_Audio);
break;
case MTP_OFC_WMA:
Notify(msgWMA);
break;
case MTP_OFC_OGG:
Notify(msgOGG);
break;
case MTP_OFC_AAC:
Notify(msgAAC);
break;
case MTP_OFC_Audible:
Notify(msgAudible);
break;
case MTP_OFC_FLAC:
Notify(msgFLAC);
break;
case MTP_OFC_Undefined_Video:
Notify(msgUndefined_Video);
break;
case MTP_OFC_WMV:
Notify(msgWMV);
break;
case MTP_OFC_MP4_Container:
Notify(msgMP4_Container);
break;
case MTP_OFC_MP2:
Notify(msgMP2);
break;
case MTP_OFC_3GP_Container:
Notify(msg3GP_Container);
break;
default:
Notify(PSTR("Vendor defined"));
}
}
Notify(PSTR("\r\n"));
}
 
void PTPObjInfoParser::Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset)
{
uint16_t cntdn = (uint16_t)len;
uint8_t *p = (uint8_t*)pbuf;
 
switch (nStage)
{
case 0:
p += 12;
cntdn -= 12;
nStage ++;
case 1:
Notify(PSTR("Storage ID:\t\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 2:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 3:
Notify(PSTR("\r\nObject Format:\t\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 4:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintFormat(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 5:
Notify(PSTR("Protection Status:\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 6:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint16_t>(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 7:
Notify(PSTR("\r\nObject Compressed Size:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 8:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 9:
Notify(PSTR("\r\nThumb Format:\t\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 10:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintFormat(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 11:
Notify(PSTR("Thumb Compressed Size:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 12:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 13:
Notify(PSTR("\r\nThumb Pix Width:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 14:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 15:
Notify(PSTR("\r\nThumb Pix Height:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 16:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 17:
Notify(PSTR("\r\nImage Pix Width:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 18:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 19:
Notify(PSTR("\r\nImage Pix Height:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 20:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 21:
Notify(PSTR("\r\nImage Bit Depth:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 22:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 23:
Notify(PSTR("\r\nParent Object:\t\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 24:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 25:
Notify(PSTR("\r\nAssociation Type:\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 26:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint16_t>(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 27:
Notify(PSTR("\r\nAssociation Desc:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 28:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 29:
Notify(PSTR("\r\nSequence Number:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 30:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 31:
Notify(PSTR("\r\nFile Name:\t\t"));
arrayParser.Initialize(1, 2, &theBuffer);
nStage ++;
case 32:
if (!arrayParser.Parse(&p, &cntdn, (PTP_ARRAY_EL_FUNC)&PrintChar))
return;
nStage ++;
case 33:
Notify(PSTR("\r\nCapture Date:\t\t"));
arrayParser.Initialize(1, 2, &theBuffer);
nStage ++;
case 34:
if (!arrayParser.Parse(&p, &cntdn, (PTP_ARRAY_EL_FUNC)&PrintChar))
return;
nStage ++;
case 35:
Notify(PSTR("\r\nModification Date:\t"));
arrayParser.Initialize(1, 2, &theBuffer);
nStage ++;
case 36:
if (!arrayParser.Parse(&p, &cntdn, (PTP_ARRAY_EL_FUNC)&PrintChar))
return;
nStage ++;
case 37:
Notify(PSTR("\r\nKeywords:\t"));
arrayParser.Initialize(1, 2, &theBuffer);
nStage ++;
case 38:
if (!arrayParser.Parse(&p, &cntdn, (PTP_ARRAY_EL_FUNC)&PrintChar))
return;
Notify(PSTR("\r\n"));
nStage = 0;
}
}
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSRemote/ptpobjinfoparser.h
0,0 → 1,83
#ifndef __PTPOBJINFOPARSER_H__
#define __PTPOBJINFOPARSER_H__
 
#include <ptp.h>
#include <mtpconst.h>
#include <ptpcallback.h>
 
const char msgUndefined [] PROGMEM = "Undefined";
 
// Ancillary formats
const char msgAssociation [] PROGMEM = "Association";
const char msgScript [] PROGMEM = "Script";
const char msgExecutable [] PROGMEM = "Executable";
const char msgText [] PROGMEM = "Text";
const char msgHTML [] PROGMEM = "HTML";
const char msgDPOF [] PROGMEM = "DPOF";
const char msgAIFF [] PROGMEM = "AIFF";
const char msgWAV [] PROGMEM = "WAV";
const char msgMP3 [] PROGMEM = "MP3";
const char msgAVI [] PROGMEM = "AVI";
const char msgMPEG [] PROGMEM = "MPEG";
const char msgASF [] PROGMEM = "ASF";
const char msgQT [] PROGMEM = "QT";
 
// Image formats
const char msgEXIF_JPEG [] PROGMEM = "EXIF_JPEG";
const char msgTIFF_EP [] PROGMEM = "TIFF_EP";
const char msgFlashPix [] PROGMEM = "FlashPix";
const char msgBMP [] PROGMEM = "BMP";
const char msgCIFF [] PROGMEM = "CIFF";
const char msgUndefined_0x3806 [] PROGMEM = "Undefined_0x3806";
const char msgGIF [] PROGMEM = "GIF";
const char msgJFIF [] PROGMEM = "JFIF";
const char msgPCD [] PROGMEM = "PCD";
const char msgPICT [] PROGMEM = "PICT";
const char msgPNG [] PROGMEM = "PNG";
const char msgUndefined_0x380C [] PROGMEM = "Undefined_0x380C";
const char msgTIFF [] PROGMEM = "TIFF";
const char msgTIFF_IT [] PROGMEM = "TIFF_IT";
const char msgJP2 [] PROGMEM = "JP2";
const char msgJPX [] PROGMEM = "JPX";
 
// MTP Object Formats
const char msgUndefined_Firmware [] PROGMEM = "Undefined_Firmware";
const char msgWindows_Image_Format [] PROGMEM = "Windows_Image_Format";
const char msgUndefined_Audio [] PROGMEM = "Undefined_Audio";
const char msgWMA [] PROGMEM = "WMA";
const char msgOGG [] PROGMEM = "OGG";
const char msgAAC [] PROGMEM = "AAC";
const char msgAudible [] PROGMEM = "Audible";
const char msgFLAC [] PROGMEM = "FLAC";
const char msgUndefined_Video [] PROGMEM = "Undefined_Video";
const char msgWMV [] PROGMEM = "WMV";
const char msgMP4_Container [] PROGMEM = "MP4_Container";
const char msgMP2 [] PROGMEM = "MP2";
const char msg3GP_Container [] PROGMEM = "3GP_Container";
 
 
class PTPObjInfoParser : public PTPReadParser
{
static const char* acNames[];
static const char* imNames[];
 
MultiValueBuffer theBuffer;
uint32_t varBuffer;
uint8_t nStage;
 
MultiByteValueParser valueParser;
PTPListParser arrayParser;
 
static void PrintChar(MultiValueBuffer *p)
{
if (((unsigned char*)p->pValue)[0])
Serial.print(((unsigned char*)p->pValue)[0]);
};
void PrintFormat(uint16_t op);
 
public:
PTPObjInfoParser() : nStage(0) { theBuffer.pValue = (uint8_t*)&varBuffer; };
virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset);
};
 
#endif // __PTPOBJINFOPARSER_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSRemoteSA/PSRemoteSA.pde
0,0 → 1,114
/* Canon Powershot control terminal */
#include <SPI.h>
#include <Max3421e.h>
#include <Usb.h>
#include <simpletimer.h>
#include <ptp.h>
#include <canonps.h>
#include <qep_port.h>
#include <valuelist.h>
#include <psvaluetitles.h>
 
#include "ptpdpparser.h"
#include "ptpobjinfoparser.h"
#include "pseventparser.h"
#include "psconsole.h"
 
#define DEV_ADDR 1
 
// Canon PowerShot S3 IS
#define DATA_IN_EP 1
#define DATA_OUT_EP 2
#define INTERRUPT_EP 3
#define CONFIG_NUM 1
 
class CamStateHandlers : public PSStateHandlers
{
enum CamStates { stInitial, stDisconnected, stConnected };
CamStates stateConnected;
public:
CamStateHandlers() : stateConnected(stInitial)
{
};
virtual void OnDeviceDisconnectedState(PTP *ptp);
virtual void OnDeviceInitializedState(PTP *ptp);
};
 
CamStateHandlers CamStates;
SimpleTimer ControlTimer, PTPPollTimer;
 
CanonPS Ps(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);
QEvent evtTick, evtAbort;
PSConsole psConsole;
 
void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
{
if (stateConnected == stConnected || stateConnected == stInitial)
{
stateConnected = stDisconnected;
PTPPollTimer.Disable();
Notify(PSTR("Camera disconnected.\r\n"));
if (stateConnected == stConnected)
psConsole.dispatch(&evtTick);
}
}
 
void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
{
if (stateConnected == stDisconnected || stateConnected == stInitial)
{
stateConnected = stConnected;
PTPPollTimer.Enable();
psConsole.dispatch(&evtTick);
}
int8_t index = psConsole.MenuSelect();
if (index >= 0)
{
MenuSelectEvt menu_sel_evt;
menu_sel_evt.sig = MENU_SELECT_SIG;
menu_sel_evt.item_index = index;
psConsole.dispatch(&menu_sel_evt); // dispatch the event
}
}
 
void OnPTPPollTimer()
{
PSEventParser prs;
Ps.EventCheck(&prs);
if (uint32_t handle = prs.GetObjHandle())
{
PTPObjInfoParser inf;
Ps.GetObjectInfo(handle, &inf);
}
}
 
void setup()
{
pinMode(6, OUTPUT); //OSD CS
digitalWrite(6, HIGH); //Disablibg OSD CS
Serial.begin(115200);
Ps.Setup();
delay( 200 );
PTPPollTimer.Set(OnPTPPollTimer, 300);
evtTick.sig = TICK_SIG;
// evtAbort.sig = ABORT_SIG;
psConsole.init();
 
Serial.println("Start");
}
 
void loop()
{
Ps.Task();
PTPPollTimer.Run();
}
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSRemoteSA/psconsole.cpp
0,0 → 1,475
#include "psconsole.h"
#include <psvaluetitles.h>
#include <valuelist.h>
 
extern CanonPS Ps;
 
/* fixes avr-gcc incompatibility with virtual destructors */
void operator delete( void *p ) {}
 
const char* menuMain[] = {"Capture", "View Settings", "Change Settings", "Viewfinder On", "Viewfinder Off"};
const char* menuChangeSettings[] = {"Mode", "Aperture", "Shutter Speed", "WB", "ISO", "Exp Comp", "CamOutput", "Zoom"};
const char* menuUpDown[] = {"<<", ">>"};
 
#define MAIN_MENU_COUNT sizeof(menuMain) / sizeof(const char*)
#define CHSET_MENU_COUNT sizeof(menuChangeSettings) / sizeof(const char*)
#define UPDWN_MENU_COUNT sizeof(menuUpDown) / sizeof(const char*)
 
void PrintMode()
{
Notify(PSTR("Mode:"));
PrintValueTitle<uint8_t, VT_MODE, VT_MODE_COUNT, VT_MODE_TEXT_LEN>((PTP*)&Ps, PS_DPC_ShootingMode, ModeTitles);
Notify(PSTR("\r\n"));
}
 
void PrintAperture()
{
Notify(PSTR("F:"));
PrintValueTitle<uint16_t, VT_APERTURE, VT_APT_COUNT, VT_APT_TEXT_LEN>((PTP*)&Ps, PS_DPC_Aperture, ApertureTitles);
Notify(PSTR("\r\n"));
}
 
void PrintShutterSpeed()
{
Notify(PSTR("T:"));
PrintValueTitle<uint16_t, VT_SHSPEED, VT_SHSPEED_COUNT, VT_SHSPEED_TEXT_LEN>((PTP*)&Ps, PS_DPC_ShutterSpeed, ShutterSpeedTitles);
Notify(PSTR("\r\n"));
}
 
void PrintWB()
{
Notify(PSTR("WB:"));
PrintValueTitle<uint8_t, VT_WB, VT_WB_COUNT, VT_WB_TEXT_LEN>((PTP*)&Ps, PS_DPC_WhiteBalance, WbTitles);
Notify(PSTR("\r\n"));
}
 
void PrintIso()
{
Notify(PSTR("ISO:"));
PrintValueTitle<uint16_t, VT_ISO, VT_ISO_COUNT, VT_ISO_TEXT_LEN>((PTP*)&Ps, PS_DPC_ISOSpeed, IsoTitles);
Notify(PSTR("\r\n"));
}
 
void PrintExpCompensation()
{
Notify(PSTR("ExpComp:"));
PrintValueTitle<uint8_t, VT_EXPCOMP, VT_EXPCOMP_COUNT, VT_EXPCOMP_TEXT_LEN>((PTP*)&Ps, PS_DPC_ExpCompensation, ExpCompTitles);
Notify(PSTR("\r\n"));
}
 
void PrintCamOutput()
{
Notify(PSTR("CamOutput:"));
PrintValueTitle<uint8_t, VT_CAMOUTPUT, VT_CAMOUTPUT_COUNT, VT_CAMOUTPUT_TEXT_LEN>((PTP*)&Ps, PS_DPC_CameraOutput, CamOutputTitles);
Notify(PSTR("\r\n"));
}
 
void PrintZoom()
{
uint16_t val = 0;
Notify(PSTR("Zoom:"));
if (Ps.GetDevicePropValue(PS_DPC_Zoom, (uint16_t&)val) == PTP_RC_OK)
PrintHex<uint16_t>(val);
Notify(PSTR("\r\n"));
}
 
void PSConsole::ShowParams()
{
PrintMode();
PrintAperture();
PrintShutterSpeed();
PrintWB();
PrintIso();
PrintExpCompensation();
PrintCamOutput();
PrintZoom();
}
 
QState PSConsole::Initial(PSConsole *me, QEvent const *e)
{
return Q_TRAN(&PSConsole::Inactive);
}
 
QState PSConsole::Inactive(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
Notify(PSTR("Inactive\r\n"));
return Q_HANDLED();
case TICK_SIG:
return Q_TRAN(&PSConsole::Active);
}
return Q_SUPER(QHsm::top);
}
 
QState PSConsole::Active(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
Notify(PSTR("Active\r\n"));
return Q_HANDLED();
case Q_INIT_SIG:
return Q_TRAN(&PSConsole::MainMenu);
case TICK_SIG:
return Q_TRAN(&PSConsole::Inactive);
}
return Q_SUPER(QHsm::top);
}
 
void PSConsole::PrintMenuTitles(uint8_t count, const char **menu)
{
Serial.println("");
for (uint8_t i=0; i<=count; i++)
{
Serial.print(i, DEC);
Serial.print(". ");
if (i == 0)
Serial.println("<..>");
else
Serial.println(menu[i-1]);
}
Serial.println("");
}
 
QState PSConsole::MainMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(MAIN_MENU_COUNT, menuMain);
return Q_HANDLED();
case MENU_SELECT_SIG:
{
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
PrintMenuTitles(MAIN_MENU_COUNT, menuMain);
return Q_HANDLED();
case 1:
Ps.SetDevicePropValue(PS_DPC_CaptureTransferMode, (uint16_t)0x0D);
Ps.Capture();
return Q_HANDLED();
case 2:
ShowParams();
PrintMenuTitles(MAIN_MENU_COUNT, menuMain);
return Q_HANDLED();
case 3:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 4:
Ps.Operation(PS_OC_ViewfinderOn);
return Q_HANDLED();
case 5:
Ps.Operation(PS_OC_ViewfinderOff);
return Q_HANDLED();
}
}
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeSettingsMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(CHSET_MENU_COUNT, menuChangeSettings);
return Q_HANDLED();
case MENU_SELECT_SIG:
{
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::MainMenu);
case 1: // Aperture
return Q_TRAN(&PSConsole::ChangeModeMenu);
case 2: // Aperture
return Q_TRAN(&PSConsole::ChangeApertureMenu);
case 3: // Shutter Speed
return Q_TRAN(&PSConsole::ChangeShutterSpeedMenu);
case 4: // White Balance
return Q_TRAN(&PSConsole::ChangeWBMenu);
case 5: // ISO
return Q_TRAN(&PSConsole::ChangeIsoMenu);
case 6: // Exposure Compensation
return Q_TRAN(&PSConsole::ChangeExpCompMenu);
case 7: // Camera Output
return Q_TRAN(&PSConsole::ChangeCamOutputMenu);
case 8: // Zoom
return Q_TRAN(&PSConsole::ChangeZoomMenu);
} // switch
}
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeModeMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintMode();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 2:
StepUp<uint8_t>((PTP*)&Ps, PS_DPC_ShootingMode);
PrintMode();
return Q_HANDLED();
case 1:
StepDown<uint8_t>((PTP*)&Ps, PS_DPC_ShootingMode);
PrintMode();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeApertureMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintAperture();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 2:
StepUp<uint16_t>((PTP*)&Ps, PS_DPC_Aperture);
PrintAperture();
return Q_HANDLED();
case 1:
StepDown<uint16_t>((PTP*)&Ps, PS_DPC_Aperture);
PrintAperture();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeShutterSpeedMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintShutterSpeed();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 2:
StepUp<uint16_t>((PTP*)&Ps, PS_DPC_ShutterSpeed);
PrintShutterSpeed();
return Q_HANDLED();
case 1:
StepDown<uint16_t>((PTP*)&Ps, PS_DPC_ShutterSpeed);
PrintShutterSpeed();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeWBMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintWB();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 2:
StepUp<uint8_t>((PTP*)&Ps, PS_DPC_WhiteBalance);
PrintWB();
return Q_HANDLED();
case 1:
StepDown<uint8_t>((PTP*)&Ps, PS_DPC_WhiteBalance);
PrintWB();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeIsoMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintIso();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 2:
StepUp<uint16_t>((PTP*)&Ps, PS_DPC_ISOSpeed);
PrintIso();
return Q_HANDLED();
case 1:
StepDown<uint16_t>((PTP*)&Ps, PS_DPC_ISOSpeed);
PrintIso();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeExpCompMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintExpCompensation();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
uint8_t new_value;
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 1:
StepUp<uint8_t>((PTP*)&Ps, PS_DPC_ExpCompensation);
PrintExpCompensation();
return Q_HANDLED();
case 2:
StepDown<uint8_t>((PTP*)&Ps, PS_DPC_ExpCompensation);
PrintExpCompensation();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeCamOutputMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintCamOutput();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 2:
StepUp<uint8_t>((PTP*)&Ps, PS_DPC_CameraOutput);
PrintCamOutput();
return Q_HANDLED();
case 1:
StepDown<uint8_t>((PTP*)&Ps, PS_DPC_CameraOutput);
PrintCamOutput();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
QState PSConsole::ChangeZoomMenu(PSConsole *me, QEvent const *e)
{
switch (e->sig)
{
case Q_ENTRY_SIG:
PrintMenuTitles(UPDWN_MENU_COUNT, menuUpDown);
PrintZoom();
return Q_HANDLED();
case MENU_SELECT_SIG:
{
switch (((MenuSelectEvt*)e)->item_index)
{
case 0:
return Q_TRAN(&PSConsole::ChangeSettingsMenu);
case 2:
StepUp<uint16_t>((PTP*)&Ps, PS_DPC_Zoom);
PrintZoom();
return Q_HANDLED();
case 1:
StepDown<uint16_t>((PTP*)&Ps, PS_DPC_Zoom);
PrintZoom();
return Q_HANDLED();
} // switch (((MenuSelectEvt*)e)->item_index)
} // case MENU_SELECT_SIG:
}
return Q_SUPER(&PSConsole::Active);
}
 
static TickEvt tick_evt;
 
int8_t PSConsole::MenuSelect()
{
if( !Serial.available())
return -1;
uint8_t char_count = 0;
uint8_t index = 0;
while (Serial.available() > 0 && char_count < 2)
{
uint8_t key = Serial.read();
key -= '0';
if (index)
{
uint8_t tmp = index;
// index *= 10;
index <<= 3;
index += tmp;
index += tmp;
}
index += key;
char_count ++;
}
return (char_count) ? (int8_t)index : (int8_t)-1;
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSRemoteSA/psconsole.h
0,0 → 1,56
#if !defined(__PSCONSOLE_H__)
#define __PSCONSOLE_H__
 
#include <inttypes.h>
#include <avr/pgmspace.h>
#include <qep_port.h>
#include <WProgram.h>
#include <canonps.h>
 
#include "ptpdpparser.h"
 
enum TextMenuSignals
{
MENU_SELECT_SIG = Q_USER_SIG,
TICK_SIG
};
 
struct TickEvt : public QEvent
{
uint8_t fine_time; // the fine 1/10 s counter
};
 
struct MenuSelectEvt : public QEvent
{
uint8_t item_index;
};
 
class PSConsole : public QHsm
{
static void PrintMenuTitles(uint8_t count, const char **menu);
static void ShowParams();
public:
PSConsole()
: QHsm((QStateHandler)&PSConsole::Initial)
{};
int8_t MenuSelect();
 
protected:
static QState Initial(PSConsole *me, QEvent const *e);
static QState Inactive(PSConsole *me, QEvent const *e);
static QState Active(PSConsole *me, QEvent const *e);
static QState MainMenu(PSConsole *me, QEvent const *e);
static QState ChangeSettingsMenu(PSConsole *me, QEvent const *e);
static QState ChangeModeMenu(PSConsole *me, QEvent const *e);
static QState ChangeApertureMenu(PSConsole *me, QEvent const *e);
static QState ChangeShutterSpeedMenu(PSConsole *me, QEvent const *e);
static QState ChangeWBMenu(PSConsole *me, QEvent const *e);
static QState ChangeImageModeMenu(PSConsole *me, QEvent const *e);
static QState ChangeExpCompMenu(PSConsole *me, QEvent const *e);
static QState ChangeIsoMenu(PSConsole *me, QEvent const *e);
static QState ChangeCamOutputMenu(PSConsole *me, QEvent const *e);
static QState ChangeZoomMenu(PSConsole *me, QEvent const *e);
};
 
#endif // __PSCONSOLE_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSRemoteSA/pseventparser.cpp
0,0 → 1,85
#include "pseventparser.h"
 
void PSEventParser::Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset)
{
uint16_t cntdn = (uint16_t)len;
uint8_t *p = (uint8_t*)pbuf;
 
switch (nStage)
{
case 0:
p += 12;
cntdn -= 12;
 
if (!cntdn)
return;
nStage ++;
 
case 1:
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 2:
if (!valueParser.Parse(&p, &cntdn))
return;
 
//PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 3:
//Notify(PSTR("\r\nNumber of Fields:\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 4:
if (!valueParser.Parse(&p, &cntdn))
return;
 
//PrintHex<uint16_t>(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 5:
//Notify(PSTR("\r\nEvent Code:\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 6:
if (!valueParser.Parse(&p, &cntdn))
return;
 
eventCode = *((uint16_t*)theBuffer.pValue);
//PrintHex<uint16_t>(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 7:
//Notify(PSTR("\r\nTransaction ID:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 8:
if (!valueParser.Parse(&p, &cntdn))
return;
 
//PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 9:
if (eventCode == PTP_EC_ObjectAdded)
Notify(PSTR("\r\nObject Added:\t\t"));
 
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 10:
if (eventCode == PTP_EC_ObjectAdded)
{
if (!valueParser.Parse(&p, &cntdn))
return;
 
objHandle = *((uint32_t*)theBuffer.pValue);
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
Notify(PSTR("\r\n"));
}
if (eventCode == PTP_EC_CaptureComplete)
Notify(PSTR("\r\nCapture complete.\r\n"));
nStage ++;
case 11:
nStage = 0;
}
}
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSRemoteSA/pseventparser.h
0,0 → 1,29
#ifndef __PSEVENTPARSER_H__
#define __PSEVENTPARSER_H__
 
#include <inttypes.h>
#include <avr/pgmspace.h>
#include "ptpcallback.h"
#include "ptpdebug.h"
#include "canonps.h"
 
class PSEventParser : public PTPReadParser
{
MultiValueBuffer theBuffer;
uint32_t varBuffer;
uint8_t nStage;
uint16_t eventCode;
uint32_t objHandle;
 
MultiByteValueParser valueParser;
 
public:
PSEventParser() : nStage(0), varBuffer(0), objHandle(0)
{
theBuffer.pValue = &varBuffer;
};
uint32_t GetObjHandle() { return objHandle; };
virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset);
};
 
#endif // __PSEVENTPARSER_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSRemoteSA/ptpobjinfoparser.cpp
0,0 → 1,298
#include "ptpobjinfoparser.h"
 
const char* PTPObjInfoParser::acNames[] PROGMEM =
{
msgUndefined,
msgAssociation,
msgScript,
msgExecutable,
msgText,
msgHTML,
msgDPOF,
msgAIFF,
msgWAV,
msgMP3,
msgAVI,
msgMPEG,
msgASF,
msgQT
};
 
const char* PTPObjInfoParser::imNames[] PROGMEM =
{
msgUndefined,
msgEXIF_JPEG,
msgTIFF_EP,
msgFlashPix,
msgBMP,
msgCIFF,
msgUndefined_0x3806,
msgGIF,
msgJFIF,
msgPCD,
msgPICT,
msgPNG,
msgUndefined_0x380C,
msgTIFF,
msgTIFF_IT,
msgJP2,
msgJPX,
};
 
void PTPObjInfoParser::PrintFormat(uint16_t op)
{
Serial.print(op, HEX);
Serial.print("\t");
//Notify(msgTab);
 
if ((((op >> 8) & 0xFF) == 0x30) && ((op & 0xFF) <= (PTP_OFC_QT & 0xFF)))
Notify((char*)pgm_read_word(&acNames[(op & 0xFF)]));
else
if ((((op >> 8) & 0xFF) == 0x38) && ((op & 0xFF) <= (PTP_OFC_JPX & 0xFF)))
Notify((char*)pgm_read_word(&imNames[(op & 0xFF)]));
else
{
switch (op)
{
case MTP_OFC_Undefined_Firmware:
Notify(msgUndefined_Firmware);
break;
case MTP_OFC_Windows_Image_Format:
Notify(msgWindows_Image_Format);
break;
case MTP_OFC_Undefined_Audio:
Notify(msgUndefined_Audio);
break;
case MTP_OFC_WMA:
Notify(msgWMA);
break;
case MTP_OFC_OGG:
Notify(msgOGG);
break;
case MTP_OFC_AAC:
Notify(msgAAC);
break;
case MTP_OFC_Audible:
Notify(msgAudible);
break;
case MTP_OFC_FLAC:
Notify(msgFLAC);
break;
case MTP_OFC_Undefined_Video:
Notify(msgUndefined_Video);
break;
case MTP_OFC_WMV:
Notify(msgWMV);
break;
case MTP_OFC_MP4_Container:
Notify(msgMP4_Container);
break;
case MTP_OFC_MP2:
Notify(msgMP2);
break;
case MTP_OFC_3GP_Container:
Notify(msg3GP_Container);
break;
default:
Notify(PSTR("Vendor defined"));
}
}
Notify(PSTR("\r\n"));
}
 
void PTPObjInfoParser::Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset)
{
uint16_t cntdn = (uint16_t)len;
uint8_t *p = (uint8_t*)pbuf;
 
switch (nStage)
{
case 0:
p += 12;
cntdn -= 12;
nStage ++;
case 1:
Notify(PSTR("Storage ID:\t\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 2:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 3:
Notify(PSTR("\r\nObject Format:\t\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 4:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintFormat(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 5:
Notify(PSTR("Protection Status:\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 6:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint16_t>(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 7:
Notify(PSTR("\r\nObject Compressed Size:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 8:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 9:
Notify(PSTR("\r\nThumb Format:\t\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 10:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintFormat(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 11:
Notify(PSTR("Thumb Compressed Size:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 12:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 13:
Notify(PSTR("\r\nThumb Pix Width:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 14:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 15:
Notify(PSTR("\r\nThumb Pix Height:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 16:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 17:
Notify(PSTR("\r\nImage Pix Width:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 18:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 19:
Notify(PSTR("\r\nImage Pix Height:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 20:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 21:
Notify(PSTR("\r\nImage Bit Depth:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 22:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 23:
Notify(PSTR("\r\nParent Object:\t\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 24:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 25:
Notify(PSTR("\r\nAssociation Type:\t"));
theBuffer.valueSize = 2;
valueParser.Initialize(&theBuffer);
nStage ++;
case 26:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint16_t>(*((uint16_t*)theBuffer.pValue));
nStage ++;
case 27:
Notify(PSTR("\r\nAssociation Desc:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 28:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 29:
Notify(PSTR("\r\nSequence Number:\t"));
theBuffer.valueSize = 4;
valueParser.Initialize(&theBuffer);
nStage ++;
case 30:
if (!valueParser.Parse(&p, &cntdn))
return;
PrintHex<uint32_t>(*((uint32_t*)theBuffer.pValue));
nStage ++;
case 31:
Notify(PSTR("\r\nFile Name:\t\t"));
arrayParser.Initialize(1, 2, &theBuffer);
nStage ++;
case 32:
if (!arrayParser.Parse(&p, &cntdn, (PTP_ARRAY_EL_FUNC)&PrintChar))
return;
nStage ++;
case 33:
Notify(PSTR("\r\nCapture Date:\t\t"));
arrayParser.Initialize(1, 2, &theBuffer);
nStage ++;
case 34:
if (!arrayParser.Parse(&p, &cntdn, (PTP_ARRAY_EL_FUNC)&PrintChar))
return;
nStage ++;
case 35:
Notify(PSTR("\r\nModification Date:\t"));
arrayParser.Initialize(1, 2, &theBuffer);
nStage ++;
case 36:
if (!arrayParser.Parse(&p, &cntdn, (PTP_ARRAY_EL_FUNC)&PrintChar))
return;
nStage ++;
case 37:
Notify(PSTR("\r\nKeywords:\t"));
arrayParser.Initialize(1, 2, &theBuffer);
nStage ++;
case 38:
if (!arrayParser.Parse(&p, &cntdn, (PTP_ARRAY_EL_FUNC)&PrintChar))
return;
Notify(PSTR("\r\n"));
nStage = 0;
}
}
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PSRemoteSA/ptpobjinfoparser.h
0,0 → 1,83
#ifndef __PTPOBJINFOPARSER_H__
#define __PTPOBJINFOPARSER_H__
 
#include <ptp.h>
#include <mtpconst.h>
#include <ptpcallback.h>
 
const char msgUndefined [] PROGMEM = "Undefined";
 
// Ancillary formats
const char msgAssociation [] PROGMEM = "Association";
const char msgScript [] PROGMEM = "Script";
const char msgExecutable [] PROGMEM = "Executable";
const char msgText [] PROGMEM = "Text";
const char msgHTML [] PROGMEM = "HTML";
const char msgDPOF [] PROGMEM = "DPOF";
const char msgAIFF [] PROGMEM = "AIFF";
const char msgWAV [] PROGMEM = "WAV";
const char msgMP3 [] PROGMEM = "MP3";
const char msgAVI [] PROGMEM = "AVI";
const char msgMPEG [] PROGMEM = "MPEG";
const char msgASF [] PROGMEM = "ASF";
const char msgQT [] PROGMEM = "QT";
 
// Image formats
const char msgEXIF_JPEG [] PROGMEM = "EXIF_JPEG";
const char msgTIFF_EP [] PROGMEM = "TIFF_EP";
const char msgFlashPix [] PROGMEM = "FlashPix";
const char msgBMP [] PROGMEM = "BMP";
const char msgCIFF [] PROGMEM = "CIFF";
const char msgUndefined_0x3806 [] PROGMEM = "Undefined_0x3806";
const char msgGIF [] PROGMEM = "GIF";
const char msgJFIF [] PROGMEM = "JFIF";
const char msgPCD [] PROGMEM = "PCD";
const char msgPICT [] PROGMEM = "PICT";
const char msgPNG [] PROGMEM = "PNG";
const char msgUndefined_0x380C [] PROGMEM = "Undefined_0x380C";
const char msgTIFF [] PROGMEM = "TIFF";
const char msgTIFF_IT [] PROGMEM = "TIFF_IT";
const char msgJP2 [] PROGMEM = "JP2";
const char msgJPX [] PROGMEM = "JPX";
 
// MTP Object Formats
const char msgUndefined_Firmware [] PROGMEM = "Undefined_Firmware";
const char msgWindows_Image_Format [] PROGMEM = "Windows_Image_Format";
const char msgUndefined_Audio [] PROGMEM = "Undefined_Audio";
const char msgWMA [] PROGMEM = "WMA";
const char msgOGG [] PROGMEM = "OGG";
const char msgAAC [] PROGMEM = "AAC";
const char msgAudible [] PROGMEM = "Audible";
const char msgFLAC [] PROGMEM = "FLAC";
const char msgUndefined_Video [] PROGMEM = "Undefined_Video";
const char msgWMV [] PROGMEM = "WMV";
const char msgMP4_Container [] PROGMEM = "MP4_Container";
const char msgMP2 [] PROGMEM = "MP2";
const char msg3GP_Container [] PROGMEM = "3GP_Container";
 
 
class PTPObjInfoParser : public PTPReadParser
{
static const char* acNames[];
static const char* imNames[];
 
MultiValueBuffer theBuffer;
uint32_t varBuffer;
uint8_t nStage;
 
MultiByteValueParser valueParser;
PTPListParser arrayParser;
 
static void PrintChar(MultiValueBuffer *p)
{
if (((unsigned char*)p->pValue)[0])
Serial.print(((unsigned char*)p->pValue)[0]);
};
void PrintFormat(uint16_t op);
 
public:
PTPObjInfoParser() : nStage(0) { theBuffer.pValue = (uint8_t*)&varBuffer; };
virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset);
};
 
#endif // __PTPOBJINFOPARSER_H__
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PTPCapture/PTPCapture.pde
0,0 → 1,71
#include <inttypes.h>
#include <avr/pgmspace.h>
 
#include <Max3421e.h>
#include <Max3421e_constants.h>
#include <Max_LCD.h>
#include <Usb.h>
 
#include <ptp.h>
 
#define DEV_ADDR 1
 
// Nikon CoolPix P100
#define DATA_IN_EP 2
#define DATA_OUT_EP 1
#define INTERRUPT_EP 3
#define CONFIG_NUM 1
 
// Canon
//#define DATA_IN_EP 1
//#define DATA_OUT_EP 2
//#define INTERRUPT_EP 3
//#define CONFIG_NUM 1
 
#define MAX_USB_STRING_LEN 64
 
class CamStateHandlers : public PTPStateHandlers
{
bool stateConnected;
public:
CamStateHandlers() : stateConnected(false) {};
virtual void OnDeviceDisconnectedState(PTP *ptp);
virtual void OnDeviceInitializedState(PTP *ptp);
} CamStates;
 
PTP Ptp(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);
 
void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
{
if (stateConnected)
{
stateConnected = false;
Notify(PSTR("Camera disconnected\r\n"));
}
}
 
void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
{
if (!stateConnected)
{
stateConnected = true;
Ptp.CaptureImage();
delay(1000);
}
}
 
void setup() {
Serial.begin( 115200 );
Serial.println("Start");
Ptp.Setup();
delay( 200 );
}
 
void loop()
{
Ptp.Task();
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PTPDevInfo/PTPDevInfo.pde
0,0 → 1,78
#include <inttypes.h>
#include <avr/pgmspace.h>
 
//#include <Spi.h>
#include <Max3421e.h>
#include <Max3421e_constants.h>
#include <Max_LCD.h>
#include <Usb.h>
 
#include <ptp.h>
#include <ptpdebug.h>
#include "devinfoparser.h"
 
#define DEV_ADDR 1
 
// Canon EOS 400D
#define DATA_IN_EP 1
#define DATA_OUT_EP 2
#define INTERRUPT_EP 3
#define CONFIG_NUM 1
 
//Nikon Coolpix L110, P100
//#define DATA_IN_EP 2
//#define DATA_OUT_EP 1
 
void setup();
void loop();
 
class CamStateHandlers : public PTPStateHandlers
{
bool stateConnected;
public:
CamStateHandlers() : stateConnected(false) {};
virtual void OnDeviceDisconnectedState(PTP *ptp);
virtual void OnDeviceInitializedState(PTP *ptp);
} CamStates;
 
PTP Ptp(DEV_ADDR, DATA_IN_EP, DATA_OUT_EP, INTERRUPT_EP, CONFIG_NUM, &CamStates);
 
void CamStateHandlers::OnDeviceDisconnectedState(PTP *ptp)
{
if (stateConnected)
{
stateConnected = false;
Notify(PSTR("Camera disconnected\r\n"));
}
}
 
void CamStateHandlers::OnDeviceInitializedState(PTP *ptp)
{
if (!stateConnected)
{
stateConnected = true;
{
HexDump dmp;
Ptp.GetDeviceInfo(&dmp);
Notify(PSTR("\n"));
}
{
DevInfoParser prs;
Ptp.GetDeviceInfo(&prs);
}
}
}
 
void setup() {
Serial.begin( 115200 );
Serial.println("Start");
Ptp.Setup();
delay( 200 );
}
 
void loop() {
Ptp.Task();
}
 
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PTPDevInfo/devinfoparser.cpp
0,0 → 1,714
#include "devinfoparser.h"
 
const char* DevInfoParser::ptpopNames[] PROGMEM =
{
msgUndefined,
msgGetDeviceInfo,
msgOpenSession,
msgCloseSession,
msgGetStorageIDs,
msgGetStorageInfo,
msgGetNumObjects,
msgGetObjectHandles,
msgGetObjectInfo,
msgGetObject,
msgGetThumb,
msgDeleteObject,
msgSendObjectInfo,
msgSendObject,
msgInitiateCapture,
msgFormatStore,
msgResetDevice,
msgSelfTest,
msgSetObjectProtection,
msgPowerDown,
msgGetDevicePropDesc,
msgGetDevicePropValue,
msgSetDevicePropValue,
msgResetDevicePropValue,
msgTerminateOpenCapture,
msgMoveObject,
msgCopyObject,
msgGetPartialObject,
msgInitiateOpenCapture
};
 
const char* DevInfoParser::mtpopNames[] PROGMEM =
{
msgUndefined,
msgGetObjectPropsSupported,
msgGetObjectPropDesc,
msgGetObjectPropValue,
msgSetObjectPropValue,
msgGetObjectPropList,
msgSetObjectPropList,
msgGetInterdependentPropDesc,
msgSendObjectPropList
};
 
const char* DevInfoParser::ptpevNames[] PROGMEM =
{
msgUndefined,
msgCancelTransaction,
msgObjectAdded,
msgObjectRemoved,
msgStoreAdded,
msgStoreRemoved,
msgDevicePropChanged,
msgObjectInfoChanged,
msgDeviceInfoChanged,
msgRequestObjectTransfer,
msgStoreFull,
msgDeviceReset,
msgStorageInfoChanged,
msgCaptureComplete,
msgUnreportedStatus
};
 
const char* DevInfoParser::mtpevNames[] PROGMEM =
{
msgUndefined,
msgObjectPropChanged,
msgObjectPropDescChanged,
msgObjectReferencesChanged
};
 
const char* DevInfoParser::ptpprNames[] PROGMEM =
{
msgUndefined,
msgBatteryLevel,
msgFunctionalMode,
msgImageSize,
msgCompressionSetting,
msgWhiteBalance,
msgRGBGain,
msgFNumber,
msgFocalLength,
msgFocusDistance,
msgFocusMode,
msgExposureMeteringMode,
msgFlashMode,
msgExposureTime,
msgExposureProgramMode,
msgExposureIndex,
msgExposureBiasCompensation,
msgDateTime,
msgCaptureDelay,
msgStillCaptureMode,
msgContrast,
msgSharpness,
msgDigitalZoom,
msgEffectMode,
msgBurstNumber,
msgBurstInterval,
msgTimelapseNumber,
msgTimelapseInterval,
msgFocusMeteringMode,
msgUploadURL,
msgArtist,
msgCopyrightInfo
};
 
const char* DevInfoParser::mtpprNames[] PROGMEM =
{
msgUndefined,
msgSynchronization_Partner,
msgDevice_Friendly_Name,
msgVolume,
msgSupportedFormatsOrdered,
msgDeviceIcon,
msgSession_Initiator_Version_Info,
msgPerceived_Device_Type,
msgPlayback_Rate,
msgPlayback_Object,
msgPlayback_Container
};
 
const char* DevInfoParser::acNames[] PROGMEM =
{
msgUndefined,
msgAssociation,
msgScript,
msgExecutable,
msgText,
msgHTML,
msgDPOF,
msgAIFF,
msgWAV,
msgMP3,
msgAVI,
msgMPEG,
msgASF,
msgQT
};
 
const char* DevInfoParser::imNames[] PROGMEM =
{
msgUndefined,
msgEXIF_JPEG,
msgTIFF_EP,
msgFlashPix,
msgBMP,
msgCIFF,
msgUndefined_0x3806,
msgGIF,
msgJFIF,
msgPCD,
msgPICT,
msgPNG,
msgUndefined_0x380C,
msgTIFF,
msgTIFF_IT,
msgJP2,
msgJPX,
};
 
DevInfoParser::DevInfoParser() :
nStage(0),
strByteCountDown(0),
waStage(0),
waLenCountDown(0),
waByteCountDown(0),
fmByteCountDown(0),
idVendor(0)
{
for (uint8_t i=0; i<4; i++) waLen[i];
waWord.word = 0;
fmBytes[0] = 0;
fmBytes[1] = 0;
};
 
bool DevInfoParser::PrintFunctMode(uint8_t **pp, uint16_t &count)
{
if (!count)
return true;
 
if (!fmByteCountDown)
fmByteCountDown = 2;
 
for (; fmByteCountDown && count; fmByteCountDown--, count--, (*pp)++)
fmBytes[fmByteCountDown & 1] = (**pp);
 
if (fmByteCountDown)
return false;
 
Notify(PSTR("Func.Mode:\t0x")); Serial.println((uint16_t)fmBytes, HEX);
return true;
}
 
void DevInfoParser::PrintOperation(uint16_t op)
{
bool bResult = false;
 
Serial.print(op, HEX);
Notify(msgTab);
 
switch (((op >> 8) & 0xFF))
{
case 0x10:
bResult = PrintPTPOperation(op);
break;
case 0x98:
bResult = PrintMTPOperation(op);
break;
default:
switch (idVendor)
{
case PTP_VENDOR_MICROSOFT:
case PTP_VENDOR_CANON:
if ((bResult = PrintPSOperation(op)))
break;
bResult = PrintEOSOperation(op);
break;
default:
Notify(msgVendorDefined);
bResult = true;
}
}
if (!bResult)
Notify(msgVendorDefined);
Notify(msgCRLF);
}
 
bool DevInfoParser::PrintPTPOperation(uint16_t op)
{
if ((op & 0xFF) <= (PTP_OC_InitiateOpenCapture & 0xFF))
{
Notify((char*)pgm_read_word(&ptpopNames[(op & 0xFF)]));
return true;
}
return false;
}
 
bool DevInfoParser::PrintMTPOperation(uint16_t op)
{
if ((op & 0xFF) <= (MTP_OC_SendObjectPropList & 0xFF))
Notify((char*)pgm_read_word(&mtpopNames[(op & 0xFF)]));
else
{
switch (op)
{
case MTP_OC_GetObjectReferences:
Notify(msgGetObjectReferences);
break;
case MTP_OC_SetObjectReferences:
Notify(msgSetObjectReferences);
break;
case MTP_OC_Skip:
Notify(msgSkip);
break;
default:
return false;
}
}
return true;
}
 
bool DevInfoParser::PrintPSOperation(uint16_t op)
{
const char* msg;
 
switch (op)
{
case PTP_OC_PS_GetObjectSize:
msg = msgPS_GetObjectSize;
break;
case PTP_OC_PS_StartShootingMode:
msg = msgPS_StartShootingMode;
break;
case PTP_OC_PS_EndShootingMode:
msg = msgPS_EndShootingMode;
break;
case PTP_OC_PS_ViewfinderOn:
msg = msgPS_ViewfinderOn;
break;
case PTP_OC_PS_ViewfinderOff:
msg = msgPS_ViewfinderOff;
break;
case PTP_OC_PS_ReflectChanges:
msg = msgPS_ReflectChanges;
break;
case PTP_OC_PS_CheckEvent:
msg = msgPS_CheckEvent;
break;
case PTP_OC_PS_FocusLock:
msg = msgPS_FocusLock;
break;
case PTP_OC_PS_FocusUnlock:
msg = msgPS_FocusUnlock;
break;
case PTP_OC_PS_InitiateCaptureInMemory:
msg = msgPS_InitiateCaptureInMemory;
break;
case PTP_OC_PS_GetPartialObject:
msg = msgPS_GetPartialObject;
break;
case PTP_OC_PS_GetViewfinderImage:
msg = msgPS_GetViewfinderImage;
break;
case PTP_OC_PS_GetChanges:
msg = msgPS_GetChanges;
break;
case PTP_OC_PS_GetFolderEntries:
msg = msgPS_GetFolderEntries;
break;
default:
return false;
}
Notify(msg);
return true;
}
 
bool DevInfoParser::PrintEOSOperation(uint16_t op)
{
const char *msg;
switch (op)
{
case PTP_OC_EOS_GetStorageIDs:
msg = msgEOS_GetStorageIDs;
break;
case PTP_OC_EOS_GetStorageInfo:
msg = msgEOS_GetStorageInfo;
break;
case PTP_OC_EOS_GetObject:
msg = msgEOS_GetObject;
break;
case PTP_OC_EOS_GetDeviceInfo:
msg = msgEOS_GetDeviceInfo;
break;
case PTP_OC_EOS_GetObjectIDs:
msg = msgEOS_GetObjectIDs;
break;
case PTP_OC_EOS_Capture:
msg = msgEOS_Capture;
break;
case PTP_OC_EOS_SetDevicePropValue:
msg = msgEOS_SetDevicePropValue;
break;
case PTP_OC_EOS_SetPCConnectMode:
msg = msgEOS_SetPCConnectMode;
break;
case PTP_OC_EOS_SetExtendedEventInfo:
msg = msgEOS_SetExtendedEventInfo;
break;
case PTP_OC_EOS_GetEvent:
msg = msgEOS_GetEvent;
break;
case PTP_OC_EOS_GetLiveViewPicture:
msg = msgEOS_GetLiveViewPicture;
break;
case PTP_OC_EOS_MoveFocus:
msg = msgEOS_MoveFocus;
break;
default:
return false;
}
Notify(msg);
return true;
}
 
void DevInfoParser::PrintEvent(uint16_t op)
{
Serial.print(op, HEX);
Notify(msgTab);
 
if ((((op >> 8) & 0xFF) == 0x40) && ((op & 0xFF) <= (PTP_EC_UnreportedStatus & 0xFF)))
Notify((char*)pgm_read_word(&ptpevNames[(op & 0xFF)]));
else
if ((((op >> 8) & 0xFF) == 0xC8) && ((op & 0xFF) <= (MTP_EC_ObjectReferencesChanged & 0xFF)))
Notify((char*)pgm_read_word(&mtpevNames[(op & 0xFF)]));
else
Notify(msgVendorDefined);
Notify(msgCRLF);
}
 
void DevInfoParser::PrintDevProp(uint16_t op)
{
Serial.print(op, HEX);
Notify(msgTab);
 
if ((((op >> 8) & 0xFF) == 0x50) && ((op & 0xFF) <= (PTP_DPC_CopyrightInfo & 0xFF)))
Notify((char*)pgm_read_word(&ptpprNames[(op & 0xFF)]));
else
if (((op >> 8) & 0xFF) == 0xD4)
{
if ( (op & 0xFF) <= (MTP_DPC_Perceived_Device_Type & 0xFF) )
Notify((char*)pgm_read_word(&mtpprNames[(op & 0xFF)]));
else
{
switch (op)
{
case MTP_DPC_Playback_Rate:
Notify(msgPlayback_Rate);
break;
case MTP_DPC_Playback_Object:
Notify(msgPlayback_Object);
break;
case MTP_DPC_Playback_Container:
Notify(msgPlayback_Container);
break;
default:
Notify(msgVendorDefined);
}
}
}
else
Notify(msgVendorDefined);
 
Notify(msgCRLF);
}
 
void DevInfoParser::PrintFormat(uint16_t op)
{
Serial.print(op, HEX);
Notify(msgTab);
 
if ((((op >> 8) & 0xFF) == 0x30) && ((op & 0xFF) <= (PTP_OFC_QT & 0xFF)))
Notify((char*)pgm_read_word(&acNames[(op & 0xFF)]));
else
if ((((op >> 8) & 0xFF) == 0x38) && ((op & 0xFF) <= (PTP_OFC_JPX & 0xFF)))
Notify((char*)pgm_read_word(&imNames[(op & 0xFF)]));
else
{
switch (op)
{
case MTP_OFC_Undefined_Firmware:
Notify(msgUndefined_Firmware);
break;
case MTP_OFC_Windows_Image_Format:
Notify(msgWindows_Image_Format);
break;
case MTP_OFC_Undefined_Audio:
Notify(msgUndefined_Audio);
break;
case MTP_OFC_WMA:
Notify(msgWMA);
break;
case MTP_OFC_OGG:
Notify(msgOGG);
break;
case MTP_OFC_AAC:
Notify(msgAAC);
break;
case MTP_OFC_Audible:
Notify(msgAudible);
break;
case MTP_OFC_FLAC:
Notify(msgFLAC);
break;
case MTP_OFC_Undefined_Video:
Notify(msgUndefined_Video);
break;
case MTP_OFC_WMV:
Notify(msgWMV);
break;
case MTP_OFC_MP4_Container:
Notify(msgMP4_Container);
break;
case MTP_OFC_MP2:
Notify(msgMP2);
break;
case MTP_OFC_3GP_Container:
Notify(msg3GP_Container);
break;
default:
Notify(msgVendorDefined);
}
}
Notify(msgCRLF);
}
 
bool DevInfoParser::PrintVendor(uint8_t **pp, uint16_t &count)
{
Notify(PSTR("Vendor Ext. ID:\t0x"));
Serial.print(*((uint32_t*)*pp),HEX);
 
switch (*((uint32_t*)*pp))
{
case PTP_VENDOR_EASTMAN_KODAK:
Notify(PSTR("(Eastman Kodak)"));
break;
case PTP_VENDOR_SEIKO_EPSON:
Notify(PSTR("(Seiko Epson)"));
break;
case PTP_VENDOR_AGILENT:
Notify(PSTR("(Agilent)"));
break;
case PTP_VENDOR_POLAROID:
Notify(PSTR("(Polaroid)"));
break;
case PTP_VENDOR_AGFA_GEVAERT:
Notify(PSTR("(AGFA)"));
break;
case PTP_VENDOR_MICROSOFT:
Notify(PSTR("(Microsoft)"));
break;
case PTP_VENDOR_EQUINOX:
Notify(PSTR("(Equinox)"));
break;
case PTP_VENDOR_VIEWQUEST:
Notify(PSTR("(ViewQuest)"));
break;
case PTP_VENDOR_STMICROELECTRONICS:
Notify(PSTR("(StMicroelectronics)"));
break;
case PTP_VENDOR_NIKON:
Notify(PSTR("(Nikon)"));
break;
case PTP_VENDOR_CANON:
Notify(PSTR("(Canon)"));
break;
case PTP_VENDOR_FOTONATION:
Notify(PSTR("(FotoNation)"));
break;
case PTP_VENDOR_PENTAX:
Notify(PSTR("(Pentax)"));
break;
case PTP_VENDOR_FUJI:
Notify(PSTR("(Fuji)"));
break;
default:
Notify(PSTR("(Unknown)"));
}
Notify(msgCRLF);
*pp += 4; count -= 4;
return true;
}
 
bool DevInfoParser::PrintString(uint8_t **pp, uint16_t &count)
{
if (!count)
return true;
 
if ( !strByteCountDown )
{
if ( !(**pp) )
{
(*pp) ++;
count --;
return true;
}
strByteCountDown = ((**pp) << 1);
(*pp) ++;
count --;
}
 
for (; strByteCountDown && count; strByteCountDown--, count--, (*pp)++)
{
if ( !(strByteCountDown & 1) && ((**pp) > 0))
Serial.print((unsigned char)(**pp));
}
return (strByteCountDown == 0);
}
 
bool DevInfoParser::PrintWordArray(uint8_t **pp, uint16_t &count, PRINTFUNC pf = NULL)
{
switch (waStage)
{
case 0:
if (!waLenCountDown)
waLenCountDown = 4;
 
for (; waLenCountDown && count; waLenCountDown--, count--, (*pp)++)
waLen[4-waLenCountDown] = (**pp);
 
if (waLenCountDown)
return false;
waStage ++;
 
case 1:
for (waByteCountDown = (waByteCountDown) ? waByteCountDown : ((*((uint32_t*)waLen) << 1));
waByteCountDown && count; waByteCountDown--, count--, (*pp)++)
{
if (waByteCountDown & 1)
{
waWord.bytes[1] = (**pp);
 
if ( pf )
(this->*pf)(waWord.word);
else
Serial.println (waWord.word, HEX);
}
else
waWord.bytes[0] = (**pp);
}
if (waByteCountDown)
return false;
}
waStage = 0;
return true;
}
 
void DevInfoParser::Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset)
{
uint16_t count = (uint16_t)len;
uint8_t *p = (uint8_t*)pbuf;
 
switch (nStage)
{
case 0:
// Skip PTP container header
p += 12; count -=12;
nStage ++;
case 1:
Notify(PSTR("\r\nStd.Ver.:\t0x")); Serial.println(*(uint16_t*)p, DEC);
p += 2; count -= 2;
 
idVendor = *((uint32_t*)p);
PrintVendor(&p, count);
 
Notify(PSTR("\r\nVend.Ext.Ver.:\t0x")); Serial.println(*((uint16_t*)p), HEX);
p += 2; count -=2;
 
nStage ++;
case 2:
// Vendor extension description
//if (*p)
{
if (!PrintString(&p, count))
return;
 
Notify(msgCRLF);
}
nStage ++;
case 3:
// Functional mode
if (!PrintFunctMode(&p, count))
return;
nStage ++;
case 4:
// Operations Supported
Notify(PSTR("\r\nOperations supported:\r\n"));
nStage++;
case 5:
if (!PrintWordArray(&p, count, &DevInfoParser::PrintOperation))
return;
nStage ++;
case 6:
// Events Supported
Notify(PSTR("\r\nEvents supported:\r\n"));
nStage ++;
case 7:
if (!PrintWordArray(&p, count, &DevInfoParser::PrintEvent))
return;
nStage ++;
case 8:
// Device Properties Supported
Notify(PSTR("\r\nDevice properties supported:\r\n"));
nStage ++;
case 9:
if (!PrintWordArray(&p, count, &DevInfoParser::PrintDevProp))
return;
nStage ++;
case 10:
// Capture formats
Notify(PSTR("\r\nCapture formats:\r\n"));
nStage ++;
case 11:
if (!PrintWordArray(&p, count, &DevInfoParser::PrintFormat))
return;
nStage ++;
case 12:
// Image Formats
Notify(PSTR("\r\nImage Formats:\r\n"));
nStage ++;
case 13:
if (!PrintWordArray(&p, count, &DevInfoParser::PrintFormat))
return;
nStage ++;
case 14:
// Manufacturer
Notify(PSTR("\r\nManufacturer:\t"));
nStage ++;
case 15:
if (!PrintString(&p, count))
return;
nStage ++;
case 16:
// Model
Notify(PSTR("\r\nModel:\t\t"));
nStage ++;
case 17:
if (!PrintString(&p, count))
return;
nStage ++;
case 18:
// Device version
Notify(PSTR("\r\nDevice ver.:\t"));
nStage ++;
case 19:
if (!PrintString(&p, count))
return;
nStage ++;
case 20:
// Serial number
Notify(PSTR("\r\nSerial num.:\t"));
nStage ++;
case 21:
if (!PrintString(&p, count))
return;
Notify(PSTR("\r\n\r\n"));
//nStage = 0;
}
}
/C-OSD/arducam-osd/libraries/PTPCamera/examples/PTPDevInfo/devinfoparser.h
0,0 → 1,295
#ifndef __DEVINFOPARSER_H__
#define __DEVINFOPARSER_H__
 
#include <inttypes.h>
#include <avr/pgmspace.h>
#include <../ptp/ptpconst.h>
#include <../ptp/mtpconst.h>
#include <../ptp/ptp.h>
 
const char msgVendorDefined [] PROGMEM = "Vendor defined";
const char msgTab [] PROGMEM = "\t";
const char msgCRLF [] PROGMEM = "\r\n";
 
// PTP Operations
const char msgUndefined [] PROGMEM = "Undefined";
const char msgGetDeviceInfo [] PROGMEM = "GetDeviceInfo";
const char msgOpenSession [] PROGMEM = "OpenSession";
const char msgCloseSession [] PROGMEM = "CloseSession";
const char msgGetStorageIDs [] PROGMEM = "GetStorageIDs";
const char msgGetStorageInfo [] PROGMEM = "GetStorageInfo";
const char msgGetNumObjects [] PROGMEM = "GetNumObjects";
const char msgGetObjectHandles [] PROGMEM = "GetObjectHandles";
const char msgGetObjectInfo [] PROGMEM = "GetObjectInfo";
const char msgGetObject [] PROGMEM = "GetObject";
const char msgGetThumb [] PROGMEM = "GetThumb";
const char msgDeleteObject [] PROGMEM = "DeleteObject";
const char msgSendObjectInfo [] PROGMEM = "SendObjectInfo";
const char msgSendObject [] PROGMEM = "SendObject";
const char msgInitiateCapture [] PROGMEM = "InitiateCapture";
const char msgFormatStore [] PROGMEM = "FormatStore";
const char msgResetDevice [] PROGMEM = "ResetDevice";
const char msgSelfTest [] PROGMEM = "SelfTest";
const char msgSetObjectProtection [] PROGMEM = "SetObjectProtection";
const char msgPowerDown [] PROGMEM = "PowerDown";
const char msgGetDevicePropDesc [] PROGMEM = "GetDevicePropDesc";
const char msgGetDevicePropValue [] PROGMEM = "GetDevicePropValue";
const char msgSetDevicePropValue [] PROGMEM = "SetDevicePropValue";
const char msgResetDevicePropValue [] PROGMEM = "ResetDevicePropValue";
const char msgTerminateOpenCapture [] PROGMEM = "TerminateOpenCapture";
const char msgMoveObject [] PROGMEM = "MoveObject";
const char msgCopyObject [] PROGMEM = "CopyObject";
const char msgGetPartialObject [] PROGMEM = "GetPartialObject";
const char msgInitiateOpenCapture [] PROGMEM = "InitiateOpenCapture";
 
// MTP Operations
const char msgGetObjectPropsSupported [] PROGMEM = "GetObjectPropsSupported";
const char msgGetObjectPropDesc [] PROGMEM = "GetObjectPropDesc";
const char msgGetObjectPropValue [] PROGMEM = "GetObjectPropValue";
const char msgSetObjectPropValue [] PROGMEM = "SetObjectPropValue";
const char msgGetObjectPropList [] PROGMEM = "GetObjectPropList";
const char msgSetObjectPropList [] PROGMEM = "SetObjectPropList";
const char msgGetInterdependentPropDesc [] PROGMEM = "GetInterdependentPropDesc";
const char msgSendObjectPropList [] PROGMEM = "SendObjectPropList";
const char msgGetObjectReferences [] PROGMEM = "GetObjectReferences";
const char msgSetObjectReferences [] PROGMEM = "SetObjectReferences";
const char msgSkip [] PROGMEM = "Skip";
 
// Canon EOS Operations
const char msgEOS_GetStorageIDs [] PROGMEM = "EOS_GetStorageIDs";
const char msgEOS_GetStorageInfo [] PROGMEM = "EOS_GetStorageInfo";
const char msgEOS_GetObject [] PROGMEM = "EOS_GetObject";
const char msgEOS_GetDeviceInfo [] PROGMEM = "EOS_GetDeviceInfo";
const char msgEOS_GetObjectIDs [] PROGMEM = "EOS_GetObjectIDs";
const char msgEOS_Capture [] PROGMEM = "EOS_Capture";
const char msgEOS_SetDevicePropValue [] PROGMEM = "EOS_SetDevicePropValue";
const char msgEOS_SetPCConnectMode [] PROGMEM = "EOS_SetPCConnectMode";
const char msgEOS_SetExtendedEventInfo [] PROGMEM = "EOS_SetExtendedEventInfo";
const char msgEOS_GetEvent [] PROGMEM = "EOS_GetEvent";
const char msgEOS_GetLiveViewPicture [] PROGMEM = "EOS_GetLiveViewPicture";
const char msgEOS_MoveFocus [] PROGMEM = "EOS_MoveFocus";
 
// Canon PowerShot Operations
const char msgPS_GetObjectSize [] PROGMEM = "PS_GetObjectSize";
const char msgPS_StartShootingMode [] PROGMEM = "PS_StartShootingMode";
const char msgPS_EndShootingMode [] PROGMEM = "PS_EndShootingMode";
const char msgPS_ViewfinderOn [] PROGMEM = "PS_ViewfinderOn";
const char msgPS_ViewfinderOff [] PROGMEM = "PS_ViewfinderOff";
const char msgPS_ReflectChanges [] PROGMEM = "PS_ReflectChanges";
const char msgPS_CheckEvent [] PROGMEM = "PS_CheckEvent";
const char msgPS_FocusLock [] PROGMEM = "PS_FocusLock";
const char msgPS_FocusUnlock [] PROGMEM = "PS_FocusUnlock";
const char msgPS_InitiateCaptureInMemory [] PROGMEM = "PS_InitiateCaptureInMemory";
const char msgPS_GetPartialObject [] PROGMEM = "PS_GetPartialObject";
const char msgPS_GetViewfinderImage [] PROGMEM = "PS_GetViewfinderImage";
const char msgPS_GetChanges [] PROGMEM = "PS_GetChanges";
const char msgPS_GetFolderEntries [] PROGMEM = "PS_GetFolderEntries";
 
 
// PTP Events
const char msgCancelTransaction [] PROGMEM = "CancelTransaction";
const char msgObjectAdded [] PROGMEM = "ObjectAdded";
const char msgObjectRemoved [] PROGMEM = "ObjectRemoved";
const char msgStoreAdded [] PROGMEM = "StoreAdded";
const char msgStoreRemoved [] PROGMEM = "StoreRemoved";
const char msgDevicePropChanged [] PROGMEM = "DevicePropChanged";
const char msgObjectInfoChanged [] PROGMEM = "ObjectInfoChanged";
const char msgDeviceInfoChanged [] PROGMEM = "DeviceInfoChanged";
const char msgRequestObjectTransfer [] PROGMEM = "RequestObjectTransfer";
const char msgStoreFull [] PROGMEM = "StoreFull";
const char msgDeviceReset [] PROGMEM = "DeviceReset";
const char msgStorageInfoChanged [] PROGMEM = "StorageInfoChanged";
const char msgCaptureComplete [] PROGMEM = "CaptureComplete";
const char msgUnreportedStatus [] PROGMEM = "UnreportedStatus";
 
// MTP Events
const char msgObjectPropChanged [] PROGMEM = "ObjectPropChanged";
const char msgObjectPropDescChanged [] PROGMEM = "ObjectPropDescChanged";
const char msgObjectReferencesChanged [] PROGMEM = "ObjectReferencesChanged";
 
// PTP Device properties
const char msgBatteryLevel [] PROGMEM = "BatteryLevel";
const char msgFunctionalMode [] PROGMEM = "FunctionalMode";
const char msgImageSize [] PROGMEM = "ImageSize";
const char msgCompressionSetting [] PROGMEM = "CompressionSetting";
const char msgWhiteBalance [] PROGMEM = "WhiteBalance";
const char msgRGBGain [] PROGMEM = "RGBGain";
const char msgFNumber [] PROGMEM = "FNumber";
const char msgFocalLength [] PROGMEM = "FocalLength";
const char msgFocusDistance [] PROGMEM = "FocusDistance";
const char msgFocusMode [] PROGMEM = "FocusMode";
const char msgExposureMeteringMode [] PROGMEM = "ExposureMeteringMode";
const char msgFlashMode [] PROGMEM = "FlashMode";
const char msgExposureTime [] PROGMEM = "ExposureTime";
const char msgExposureProgramMode [] PROGMEM = "ExposureProgramMode";
const char msgExposureIndex [] PROGMEM = "ExposureIndex";
const char msgExposureBiasCompensation [] PROGMEM = "ExposureBiasCompensation";
const char msgDateTime [] PROGMEM = "DateTime";
const char msgCaptureDelay [] PROGMEM = "CaptureDelay";
const char msgStillCaptureMode [] PROGMEM = "StillCaptureMode";
const char msgContrast [] PROGMEM = "Contrast";
const char msgSharpness [] PROGMEM = "Sharpness";
const char msgDigitalZoom [] PROGMEM = "DigitalZoom";
const char msgEffectMode [] PROGMEM = "EffectMode";
const char msgBurstNumber [] PROGMEM = "BurstNumber";
const char msgBurstInterval [] PROGMEM = "BurstInterval";
const char msgTimelapseNumber [] PROGMEM = "TimelapseNumber";
const char msgTimelapseInterval [] PROGMEM = "TimelapseInterval";
const char msgFocusMeteringMode [] PROGMEM = "FocusMeteringMode";
const char msgUploadURL [] PROGMEM = "UploadURL";
const char msgArtist [] PROGMEM = "Artist";
const char msgCopyrightInfo [] PROGMEM = "CopyrightInfo";
 
// MTP Device properties
const char msgSynchronization_Partner [] PROGMEM = "Synchronization_Partner";
const char msgDevice_Friendly_Name [] PROGMEM = "Device_Friendly_Name";
const char msgVolume [] PROGMEM = "Volume";
const char msgSupportedFormatsOrdered [] PROGMEM = "SupportedFormatsOrdered";
const char msgDeviceIcon [] PROGMEM = "DeviceIcon";
const char msgSession_Initiator_Version_Info [] PROGMEM = "Session_Initiator_Version_Info";
const char msgPerceived_Device_Type [] PROGMEM = "Perceived_Device_Type";
const char msgPlayback_Rate [] PROGMEM = "Playback_Rate";
const char msgPlayback_Object [] PROGMEM = "Playback_Object";
const char msgPlayback_Container [] PROGMEM = "Playback_Container";
 
// Ancillary formats
const char msgAssociation [] PROGMEM = "Association";
const char msgScript [] PROGMEM = "Script";
const char msgExecutable [] PROGMEM = "Executable";
const char msgText [] PROGMEM = "Text";
const char msgHTML [] PROGMEM = "HTML";
const char msgDPOF [] PROGMEM = "DPOF";
const char msgAIFF [] PROGMEM = "AIFF";
const char msgWAV [] PROGMEM = "WAV";
const char msgMP3 [] PROGMEM = "MP3";
const char msgAVI [] PROGMEM = "AVI";
const char msgMPEG [] PROGMEM = "MPEG";
const char msgASF [] PROGMEM = "ASF";
const char msgQT [] PROGMEM = "QT";
 
// Image formats
const char msgEXIF_JPEG [] PROGMEM = "EXIF_JPEG";
const char msgTIFF_EP [] PROGMEM = "TIFF_EP";
const char msgFlashPix [] PROGMEM = "FlashPix";
const char msgBMP [] PROGMEM = "BMP";
const char msgCIFF [] PROGMEM = "CIFF";
const char msgUndefined_0x3806 [] PROGMEM = "Undefined_0x3806";
const char msgGIF [] PROGMEM = "GIF";
const char msgJFIF [] PROGMEM = "JFIF";
const char msgPCD [] PROGMEM = "PCD";
const char msgPICT [] PROGMEM = "PICT";
const char msgPNG [] PROGMEM = "PNG";
const char msgUndefined_0x380C [] PROGMEM = "Undefined_0x380C";
const char msgTIFF [] PROGMEM = "TIFF";
const char msgTIFF_IT [] PROGMEM = "TIFF_IT";
const char msgJP2 [] PROGMEM = "JP2";
const char msgJPX [] PROGMEM = "JPX";
 
// MTP Object Formats
const char msgUndefined_Firmware [] PROGMEM = "Undefined_Firmware";
const char msgWindows_Image_Format [] PROGMEM = "Windows_Image_Format";
const char msgUndefined_Audio [] PROGMEM = "Undefined_Audio";
const char msgWMA [] PROGMEM = "WMA";
const char msgOGG [] PROGMEM = "OGG";
const char msgAAC [] PROGMEM = "AAC";
const char msgAudible [] PROGMEM = "Audible";
const char msgFLAC [] PROGMEM = "FLAC";
const char msgUndefined_Video [] PROGMEM = "Undefined_Video";
const char msgWMV [] PROGMEM = "WMV";
const char msgMP4_Container [] PROGMEM = "MP4_Container";
const char msgMP2 [] PROGMEM = "MP2";
const char msg3GP_Container [] PROGMEM = "3GP_Container";
 
 
// PTP Operation Codes (EOS specific)
#define PTP_OC_EOS_GetStorageIDs 0x9101
#define PTP_OC_EOS_GetStorageInfo 0x9102
#define PTP_OC_EOS_GetObject 0x9107
#define PTP_OC_EOS_GetDeviceInfo 0x9108
#define PTP_OC_EOS_GetObjectIDs 0x9109
#define PTP_OC_EOS_Capture 0x910f
#define PTP_OC_EOS_SetDevicePropValue 0x9110
#define PTP_OC_EOS_SetPCConnectMode 0x9114
#define PTP_OC_EOS_SetExtendedEventInfo 0x9115
#define PTP_OC_EOS_GetEvent 0x9116
#define PTP_OC_EOS_GetLiveViewPicture 0x9153
#define PTP_OC_EOS_MoveFocus 0x9155
 
// PTP Operation Codes (PowerSot specific)
#define PTP_OC_PS_GetObjectSize 0x9001
#define PTP_OC_PS_StartShootingMode 0x9008
#define PTP_OC_PS_EndShootingMode 0x9009
#define PTP_OC_PS_ViewfinderOn 0x900B
#define PTP_OC_PS_ViewfinderOff 0x900C
#define PTP_OC_PS_ReflectChanges 0x900D
#define PTP_OC_PS_CheckEvent 0x9013
#define PTP_OC_PS_FocusLock 0x9014
#define PTP_OC_PS_FocusUnlock 0x9015
#define PTP_OC_PS_InitiateCaptureInMemory 0x901A
#define PTP_OC_PS_GetPartialObject 0x901B
#define PTP_OC_PS_GetViewfinderImage 0x901d
#define PTP_OC_PS_GetChanges 0x9020
#define PTP_OC_PS_GetFolderEntries 0x9021
 
 
 
 
class DevInfoParser : public PTPReadParser
{
static const char* ptpopNames[];
static const char* mtpopNames[];
static const char* ptpevNames[];
static const char* mtpevNames[];
static const char* acNames[];
static const char* imNames[];
static const char* ptpprNames[];
static const char* mtpprNames[];
 
uint8_t nStage;
 
// PrintString variables
uint16_t strByteCountDown;
 
// PrintWordArray variables
uint8_t waStage;
uint8_t waLenCountDown;
uint32_t waByteCountDown;
uint8_t waLen[4];
union
{
uint8_t bytes[2];
uint16_t word;
} waWord;
 
// PrintFunctMode variables
uint8_t fmByteCountDown;
uint8_t fmBytes[2];
 
 
uint16_t idVendor;
 
typedef void (DevInfoParser::*PRINTFUNC)(uint16_t);
 
bool PrintVendor(uint8_t **pp, uint16_t &count);
bool PrintFunctMode(uint8_t **pp, uint16_t &count);
bool PrintString(uint8_t **pp, uint16_t &count);
bool PrintWordArray(uint8_t **pp, uint16_t &count, PRINTFUNC pf);
 
// Print functions for PrintWordArray
void PrintOperation(uint16_t op);
 
bool PrintPTPOperation(uint16_t op);
bool PrintMTPOperation(uint16_t op);
bool PrintPSOperation(uint16_t op);
bool PrintEOSOperation(uint16_t op);
 
void PrintEvent(uint16_t op);
void PrintDevProp(uint16_t op);
void PrintFormat(uint16_t op);
 
public:
DevInfoParser();
virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset);
};
 
#endif // __DEVINFOPARSER_H__