Create location simulation example in cpp

This commit is contained in:
Jackson Coxson
2025-08-15 14:56:02 -06:00
parent b00be3fa26
commit 36770ffd67
12 changed files with 820 additions and 0 deletions

30
cpp/src/remote_server.cpp Normal file
View File

@@ -0,0 +1,30 @@
// Jackson Coxson
#include <idevice++/remote_server.hpp>
namespace IdeviceFFI {
std::optional<RemoteServer> RemoteServer::from_socket(ReadWrite&& rw, FfiError& err) {
RemoteServerHandle* out = nullptr;
// Rust consumes the stream regardless of result, release BEFORE the call
ReadWriteOpaque* raw = rw.release();
if (IdeviceFfiError* e = ::remote_server_new(raw, &out)) {
err = FfiError(e);
return std::nullopt;
}
return RemoteServer::adopt(out);
}
std::optional<RemoteServer>
RemoteServer::connect_rsd(Adapter& adapter, RsdHandshake& rsd, FfiError& err) {
RemoteServerHandle* out = nullptr;
if (IdeviceFfiError* e = ::remote_server_connect_rsd(adapter.raw(), rsd.raw(), &out)) {
err = FfiError(e);
return std::nullopt;
}
return RemoteServer::adopt(out);
}
} // namespace IdeviceFFI