forked from jkcoxson/idevice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstallcoordination_proxy.cpp
More file actions
58 lines (48 loc) · 1.7 KB
/
Copy pathinstallcoordination_proxy.cpp
File metadata and controls
58 lines (48 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Jackson Coxson
#include <idevice++/bindings.hpp>
#include <idevice++/ffi.hpp>
#include <idevice++/installcoordination_proxy.hpp>
namespace IdeviceFFI {
Result<InstallcoordinationProxy, FfiError>
InstallcoordinationProxy::connect_rsd(AdapterHandle* adapter, RsdHandshakeHandle* handshake) {
InstallcoordinationProxyHandle* out = nullptr;
FfiError e(::installcoordination_proxy_connect_rsd(adapter, handshake, &out));
if (e) {
return Err(e);
}
return Ok(InstallcoordinationProxy::adopt(out));
}
Result<InstallcoordinationProxy, FfiError>
InstallcoordinationProxy::from_readwrite_ptr(ReadWriteOpaque* consumed) {
InstallcoordinationProxyHandle* out = nullptr;
if (IdeviceFfiError* e = ::installcoordination_proxy_new(consumed, &out)) {
return Err(FfiError(e));
}
return Ok(InstallcoordinationProxy::adopt(out));
}
Result<InstallcoordinationProxy, FfiError>
InstallcoordinationProxy::from_readwrite(ReadWrite&& rw) {
return from_readwrite_ptr(rw.release());
}
Result<void, FfiError> InstallcoordinationProxy::uninstall_app(const std::string& bundle_id) {
FfiError e(::installcoordination_proxy_uninstall_app(handle_.get(), bundle_id.c_str()));
if (e) {
return Err(e);
}
return Ok();
}
Result<std::string, FfiError>
InstallcoordinationProxy::query_app_path(const std::string& bundle_id) {
char* path = nullptr;
FfiError e(::installcoordination_proxy_query_app_path(handle_.get(), bundle_id.c_str(), &path));
if (e) {
return Err(e);
}
std::string result;
if (path) {
result = path;
::idevice_string_free(path);
}
return Ok(std::move(result));
}
} // namespace IdeviceFFI