usbmuxd class implementation for usbmuxd

This commit is contained in:
Jackson Coxson
2025-07-22 10:49:14 -06:00
parent f384df91d8
commit 032a6a6751
8 changed files with 689 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
// Jackson Coxson
#include "ffi.hpp"
#include "usbmuxd.hpp"
#include <iostream>
#include <optional>
int main() {
std::cout << "Getting devices from usbmuxd\n";
IdeviceFFI::FfiError e;
std::optional<IdeviceFFI::UsbmuxdConnection> u =
IdeviceFFI::UsbmuxdConnection::default_new(0, e);
if (u == std::nullopt) {
std::cerr << "failed to connect to usbmuxd";
std::cerr << e.message;
}
auto devices = u->get_devices(e);
if (u == std::nullopt) {
std::cerr << "failed to get devices from usbmuxd";
std::cerr << e.message;
}
for (IdeviceFFI::UsbmuxdDevice& d : *devices) {
auto udid = d.get_udid();
if (!udid) {
std::cerr << "failed to get udid";
continue;
}
auto connection_type = d.get_connection_type();
if (!connection_type) {
std::cerr << "failed to get connection type";
continue;
}
std::cout << *udid << " (" << connection_type->to_string() << ")" << "\n";
}
}