MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / list_devices

Method list_devices

packages/server/src/android.rs:150–179  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

148
149impl AndroidBridge {
150 pub fn list_devices(&self) -> Result<Vec<AndroidDevice>, AppError> {
151 if !self.emulator_path().exists() {
152 return Ok(Vec::new());
153 }
154
155 let avds = self
156 .run_emulator(["-list-avds"])?
157 .lines()
158 .map(str::trim)
159 .filter(|line| !line.is_empty())
160 .map(ToOwned::to_owned)
161 .collect::<Vec<_>>();
162 if avds.is_empty() {
163 return Ok(Vec::new());
164 }
165
166 let running = self.running_emulators().unwrap_or_default();
167 avds.into_iter()
168 .enumerate()
169 .map(|(index, avd_name)| {
170 let console_port = console_port_for_avd_index(index)?;
171 Ok(AndroidDevice {
172 serial: running.get(&avd_name).cloned(),
173 is_booted: running.contains_key(&avd_name),
174 console_port,
175 avd_name,
176 })
177 })
178 .collect()
179 }
180
181 pub fn enrich_devices(&self, devices: Vec<AndroidDevice>) -> Vec<Value> {
182 devices

Callers 3

simulator_stateFunction · 0.80
all_device_valuesFunction · 0.80

Calls 6

emulator_pathMethod · 0.80
run_emulatorMethod · 0.80
is_emptyMethod · 0.80
running_emulatorsMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected