I'm trying to work with Sony's Camera Remote SDK to operate a Sony a7c camera. I've ran into trouble getting the camera to acquire photos consistently using it, as the SDK interface is asynchronous and it seems that some shutter down/up commands get lost.
I've used Sony's RemoteCli example and added my code to the CameraDevice class. This is what I'm trying to do (after setting other device parameters, like Manual Focus and Drive mode to single image):
int CameraDevice::wait_for_a_property_to_change(std::chrono::milliseconds sleep_ms, int timeout_ms) {
int wait_counter = 0;
m_property_changed = false;
while (!m_property_changed && wait_counter*sleep_ms.count() < timeout_ms) {
wait_counter++;
std::this_thread::sleep_for(sleep_ms);
}
return m_property_changed;
}
void CameraDevice::shooting_loop()
{
tout << "Shooting loop" << std::endl;
int wait_timeout_ms = 1000;
std::chrono::milliseconds sleep_time_ms = 10ms;
std::this_thread::sleep_for(1s);
for (int i=0; i<10; i++) {
std::this_thread::sleep_for(200ms);
tout << "Shutter down\n";
SDK::SendCommand(m_device_handle, SDK::CrCommandId::CrCommandId_Release, SDK::CrCommandParam::CrCommandParam_Down);
wait_for_a_property_to_change(sleep_time_ms, wait_timeout_ms);
// Wait, then send shutter up
std::this_thread::sleep_for(35ms);
tout << "Shutter up\n";
SDK::SendCommand(m_device_handle, SDK::CrCommandId::CrCommandId_Release, SDK::CrCommandParam::CrCommandParam_Up);
wait_for_a_property_to_change(sleep_time_ms, wait_timeout_ms);
}
std::this_thread::sleep_for(10000ms);
}
This is supposed to acquire 10 images, but most of the times only 7-8 images get acquired. Any idea what I'm doing wrong?