Add DVT screenshot bindings

This commit is contained in:
Jackson Coxson
2025-10-21 08:47:07 -06:00
parent 779db7ecec
commit a7daac3a46
17 changed files with 326 additions and 17 deletions

View File

@@ -1,6 +1,6 @@
// Jackson Coxson
#include <idevice++/location_simulation.hpp>
#include <idevice++/dvt/location_simulation.hpp>
namespace IdeviceFFI {

View File

@@ -1,6 +1,6 @@
// Jackson Coxson
#include <idevice++/process_control.hpp>
#include <idevice++/dvt/process_control.hpp>
namespace IdeviceFFI {

View File

@@ -1,6 +1,6 @@
// Jackson Coxson
#include <idevice++/remote_server.hpp>
#include <idevice++/dvt/remote_server.hpp>
namespace IdeviceFFI {

View File

@@ -0,0 +1,37 @@
// Jackson Coxson
#include <idevice++/dvt/screenshot.hpp>
namespace IdeviceFFI {
Result<ScreenshotClient, FfiError> ScreenshotClient::create(RemoteServer& server) {
ScreenshotClientHandle* out = nullptr;
FfiError e(::screenshot_client_new(server.raw(), &out));
if (e) {
return Err(e);
}
return Ok(ScreenshotClient::adopt(out));
}
Result<std::vector<uint8_t>, FfiError> ScreenshotClient::capture() {
uint8_t* data = nullptr;
size_t len = 0;
FfiError e(::screenshot_client_clear(handle_.get(), &data, &len));
if (e) {
return Err(e);
}
// Copy into a C++ buffer
std::vector<uint8_t> out(len);
if (len > 0 && data != nullptr) {
std::memcpy(out.data(), data, len);
}
// Free Rust-allocated data
::idevice_data_free(data, len);
return Ok(std::move(out));
}
} // namespace IdeviceFFI