2022-02-06 05:32:40 +08:00
|
|
|
#ifndef SC_ADB_DEVICE_H
|
|
|
|
#define SC_ADB_DEVICE_H
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
|
2022-02-19 04:16:53 +08:00
|
|
|
#include "util/vector.h"
|
|
|
|
|
2022-02-06 05:32:40 +08:00
|
|
|
struct sc_adb_device {
|
|
|
|
char *serial;
|
|
|
|
char *state;
|
|
|
|
char *model;
|
2022-02-06 22:04:00 +08:00
|
|
|
bool selected;
|
2022-02-06 05:32:40 +08:00
|
|
|
};
|
|
|
|
|
2022-03-23 04:07:31 +08:00
|
|
|
enum sc_adb_device_type {
|
|
|
|
SC_ADB_DEVICE_TYPE_USB,
|
|
|
|
SC_ADB_DEVICE_TYPE_TCPIP,
|
|
|
|
SC_ADB_DEVICE_TYPE_EMULATOR,
|
|
|
|
};
|
|
|
|
|
2022-02-19 04:16:53 +08:00
|
|
|
struct sc_vec_adb_devices SC_VECTOR(struct sc_adb_device);
|
|
|
|
|
2022-02-06 05:32:40 +08:00
|
|
|
void
|
|
|
|
sc_adb_device_destroy(struct sc_adb_device *device);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Move src to dst
|
|
|
|
*
|
|
|
|
* After this call, the content of src is undefined, except that
|
|
|
|
* sc_adb_device_destroy() can be called.
|
|
|
|
*
|
|
|
|
* This is useful to take a device from a list that will be destroyed, without
|
|
|
|
* making unnecessary copies.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
sc_adb_device_move(struct sc_adb_device *dst, struct sc_adb_device *src);
|
|
|
|
|
|
|
|
void
|
2022-02-19 04:16:53 +08:00
|
|
|
sc_adb_devices_destroy(struct sc_vec_adb_devices *devices);
|
2022-02-06 05:32:40 +08:00
|
|
|
|
2022-03-23 04:07:31 +08:00
|
|
|
/**
|
|
|
|
* Deduce the device type from the serial
|
|
|
|
*/
|
|
|
|
enum sc_adb_device_type
|
|
|
|
sc_adb_device_get_type(const char *serial);
|
|
|
|
|
2022-02-06 05:32:40 +08:00
|
|
|
#endif
|