Ofxcanonsdk multiple cameras problem

Hi everyone,

I’m having problems with ofxcanonSDK. I want to control multiple cameras, take a picture at the same time from all of them.

But i can’t seem to read camera serials.

Btw, how can i get all the connected cameras as an array and loop through them?

Thanks,
Alp

Here is my code so far:
===============header=============
EdsError _err;
EdsCameraListRef _cameraList;

EdsCameraRef _camera;
EdsCameraRef _camera2;

EdsDataType dataType;
EdsDataType dataType2;

EdsUInt32 dataSize;
EdsUInt32 dataSize2;

EdsUInt32 data;
EdsUInt32 data2;

EdsDeviceInfo deviceInfo;
EdsDeviceInfo deviceInfo2;

===============cpp=============
_err = EdsGetCameraList(&_cameraList);
_err = EdsGetChildAtIndex(_cameraList , 0 , &_camera);
_err = EdsGetChildAtIndex(_cameraList , 1 , &_camera2);

_err = EdsGetDeviceInfo(_camera,&deviceInfo);
_err = EdsGetDeviceInfo(_camera2,&deviceInfo2);

cout << "CAMERA INFO = " << deviceInfo.szDeviceDescription << endl;
cout << "CAMERA INFO = " << deviceInfo2.szDeviceDescription << endl;


_err = EdsGetPropertySize(_camera, kEdsPropID_BodyIDEx, 0, &dataType, &dataSize);
_err = EdsGetPropertyData(_camera, kEdsPropID_BodyIDEx, 0, dataSize, &data );


_err = EdsGetPropertySize(_camera2, kEdsPropID_BodyIDEx, 0, &dataType, &dataSize);
_err = EdsGetPropertyData(_camera2, kEdsPropID_BodyIDEx, 0, dataSize, &data2 );


cout << "CAMERA INFO SERIAL1 = " << data << endl;
cout << "CAMERA INFO SERIAL2 = " << data2 << endl;


cout << "DATASIZE INFO = " << dataSize << endl;
cout << "DATASIZE INFO = " << dataSize2 << endl;
cout << "err INFO = " << _err << endl;
char * value = new char[dataSize];
char * value2 = new char[dataSize2];
// Get the serial

_err = EdsGetPropertyData(_camera, kEdsPropID_BodyIDEx, 0, dataSize, value );
_err = EdsGetPropertyData(_camera2, kEdsPropID_BodyIDEx, 0, dataSize2, value2 );
cout << "SERIAL INFO = " << value << endl;
cout << "SERIAL INFO = " << value2 << endl;

===============output=============
[notice ] SETUP
CAMERA INFO = Canon EOS 40D
CAMERA INFO = Canon EOS 5D Mark II
CAMERA INFO SERIAL1 = 0
CAMERA INFO SERIAL2 = 0
DATASIZE INFO = 0
DATASIZE INFO = 0
err INFO = 193
SERIAL INFO =
SERIAL INFO =

Hmm, I can’t seem to find any addon ofxCanonSDK, did you mean ofxCanonEOS?

Regardless, does what ever addon you are using support attaching and controlling multiple cameras simultaneously? Looking at your code, you are using the EDSDK directly to fetch an EDSDK EdsCameraRef which is unlikely to be exposed by any addon (instead using it internally or wrapping it in some class).

Over in Cinder-land, I created Cinder-EDSDK which does expose all attached cameras - I largely copied the OS X ImageCaptureCore framework’s camera browser and delegate method abstraction to provide separate signals for when a camera is added, removed and when the list of cameras is enumerated, so your app could accumulate a list of camera objects and then issue capture requests on them:

void CaptureApp::browserDidAddCamera(CameraRef camera) {
    camera->connectFileAddedHandler(&CaptureApp::didAddFile, this);
    EdsError error = camera->requestOpenSession();
    if (error == EDS_ERR_OK) {
        mCameras->push_back(camera);
        // later coordinate some synchronized mass-capture
    }
}

This isn’t to say you should use Cinder, but just be aware of the kind of access you’d need from the addon to deal with multiple cameras - the addon would need some way for you to specify which camera you wanted to deal with. Either by exposing its camera list, through added/removed signals, or at creation time let you specify a name/index.