c++sdksony-camera-api

Sony Camera Remote SDK Connect() function does not return a device handle


I'm currently working on a project using the Sony Camera Remote SDK (v1.12.00) and I cannot get the connect function to return a device handle no matter what I do. I've tried re-downloading and rebuilding the SDK to make sure the SDK is good.

When I print the device handle after connecting all I get is "0" or (NULL) which means it hasn't changed from when it was declared.

It's also important to mention that the SDK is initializing and creating a USB object for my camera, just not going through with the connection process.

Here is the code I'm working on:

#include <cstdlib>
#include <cstdint>
#include <iomanip>
#include "CRSDK/CameraRemote_SDK.h"
#include "CameraDevice.h"
#include "Text.h"
#include <iostream>

#include <chrono>
#include <thread>

using namespace std::chrono_literals;


using namespace SCRSDK;


class MyDeviceCallback : public IDeviceCallback {
    void OnConnected(DeviceConnectionVersioin version) {
        DeviceConnectionVersioin ver = version;
        // Program can use the device handle. 
    }
};


int main() {



    CrCameraDeviceModelList usbModel = CrCameraDeviceModelList::CrCameraDeviceModel_ILX_LR1;

    ICrCameraObjectInfo* pCam = nullptr;

    CrChar serialNum[(SCRSDK::USB_SERIAL_LENGTH + 1)] = { 0 }; // +1 is Null-terminate
    memcpy(serialNum, L"D516000F44E5", sizeof(serialNum)); // wide char on Windows

    CrError err = CreateCameraObjectInfoUSBConnection(&pCam, usbModel, (unsigned char*)serialNum);

    MyDeviceCallback* cb = new MyDeviceCallback();

    CrDeviceHandle hDev = NULL;

    /*camera->connect(CrSdkControlMode_Remote, CrReconnecting_ON);*/
    Connect(pCam, cb, &hDev, CrSdkControlMode_Remote, CrReconnecting_ON, 0, 0, 0, 0U);


    std::cout << hDev << " : Device Handle" << std::endl;
    std::cout << err << std::endl;

    SendCommand(hDev, CrCommandId::CrCommandId_Release, CrCommandParam_Down);

    // Wait, then send shutter up
    std::this_thread::sleep_for(35ms);

    SendCommand(hDev, CrCommandId::CrCommandId_Release, CrCommandParam_Up);


}

I've also made sure the linker has the .lib files and that it can see the dll's and that the headers are seen.


Solution

  • After a bit of back and forth with Sony, we found a solution.

    The SCRSDK::CreateCameraInfoUSBConnection() method is broken and will be removed in the next release of the SDK. Although it appeared the SCRSDK::Connect() method was the problem. It was SCRSDK::CreateCameraInfoUSBConnection() because it was throwing no errors and my variable pCam did have some data in it.

    From now on use ICrEnumCameraObjectInfo::GetCameraObjectInfo() to generate device data.