mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 06:26:15 +01:00
Create location simulation example in cpp
This commit is contained in:
32
cpp/src/location_simulation.cpp
Normal file
32
cpp/src/location_simulation.cpp
Normal file
@@ -0,0 +1,32 @@
|
||||
// Jackson Coxson
|
||||
|
||||
#include <idevice++/location_simulation.hpp>
|
||||
|
||||
namespace IdeviceFFI {
|
||||
|
||||
std::optional<LocationSimulation> LocationSimulation::create(RemoteServer& server, FfiError& err) {
|
||||
LocationSimulationHandle* out = nullptr;
|
||||
if (IdeviceFfiError* e = ::location_simulation_new(server.raw(), &out)) {
|
||||
err = FfiError(e);
|
||||
return std::nullopt;
|
||||
}
|
||||
return LocationSimulation::adopt(out);
|
||||
}
|
||||
|
||||
bool LocationSimulation::clear(FfiError& err) {
|
||||
if (IdeviceFfiError* e = ::location_simulation_clear(handle_.get())) {
|
||||
err = FfiError(e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LocationSimulation::set(double latitude, double longitude, FfiError& err) {
|
||||
if (IdeviceFfiError* e = ::location_simulation_set(handle_.get(), latitude, longitude)) {
|
||||
err = FfiError(e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace IdeviceFFI
|
||||
Reference in New Issue
Block a user