Events
You can receive camera events of the connected camera using the CameraEventListener
class.
Contents
- Supported Camera Events
- How to Register Events
- Capture Settings Supported by CaptureSettingsChanged
- See Also
Supported Camera Events
RICOH Camera USB SDK supports the following camera events:
imageAdded
is called when image is added to the camera. You can transfer image data before ImageStored is called.imageStored
is called when image is stored to the camera storage.captureComplete
is called when capturing an image is completed.deviceDisconnected
is called when the camera you’ve already made a connection is disconnected.liveViewFrameUpdated
is called when live view frame data is updated.captureSettingsChanged
is called when supported capture settings are changed. It does not be called if you change directly withsetCaptureSettings
method.
Register Events
Override the virtual method corresponding to the event you want to receive in your derived class of CameraEventListener
. You can also see Live View for an example of liveViewFrameUpdated
.
class UserEventListener : public CameraEventListener {
public:
void imageAdded(const std::shared_ptr<const CameraDevice>& sender,
const std::shared_ptr<const CameraImage>& image) override
{
std::cout << "Image Added. Name: " << image->getName()
<< ", Type: " << static_cast<int>(image->getType())
<< ", Format: " << static_cast<int>(image->getFormat())
<< ", Size: " << image->getSize()
<< ", ID: " << image->getId() << std::endl;
}
void imageStored(const std::shared_ptr<const CameraDevice>& sender,
const std::shared_ptr<const CameraImage>& image) override
{
std::cout << "Image Stored. Name: " << image->getName()
<< ", Type: " << static_cast<int>(image->getType())
<< ", Format: " << static_cast<int>(image->getFormat())
<< ", Size: " << image->getSize()
<< ", ID: " << image->getId() << std::endl;
}
void captureComplete(const std::shared_ptr<const CameraDevice>& sender,
const std::shared_ptr<const Capture>& capture) override
{
std::cout << "Capture Complete. Capture ID: " << capture->getId()
<< std::endl;
}
void deviceDisconnected(const std::shared_ptr<const CameraDevice>& sender,
DeviceInterface inf) override
{
std::cout << "Device Disconnected." << std::endl;
}
void captureSettingsChanged(const std::shared_ptr<const CameraDevice>& sender,
const std::vector<std::shared_ptr<const CaptureSetting>>& newSettings) override
{
std::cout << "Capture Settings Changed." << std::endl;
for (auto setting : newSettings) {
std::cout << " " << setting->toString() << std::endl;
}
}
};
And register the event listener as follows:
std::shared_ptr<CameraEventListener> userEventListener =
std::make_shared<UserEventListener>();
cameraDevice->addEventListener(userEventListener);
Registered events are called when corresponding events occur at CameraDevice
.
Capture Settings Supported by CaptureSettingsChanged
The Capture Settings to be notified are as follows.
- Aperture Value
- Exposure Compensation
- ISO Sensitivity Value
- White Balance
- Shutter Speed
- Exposure Program
- Hyper Operation Settings
- User Capture Settings Mode
See Also
- Still Image Capture - Demonstrates how to capture still images.
- Connection - Demonstrates how to make connections with cameras.
- Live View - Describes
liveViewFrameUpdated
. - Capture Settings - Describes available capture settings.