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

Function native_switch_camera

packages/server/src/camera.rs:187–210  ·  view source on GitHub ↗
(
    udid: &str,
    source: &CameraSource,
    mirror: Option<&str>,
)

Source from the content-addressed store, hash-verified

185}
186
187fn native_switch_camera(
188 udid: &str,
189 source: &CameraSource,
190 mirror: Option<&str>,
191) -> Result<Value, AppError> {
192 let udid = cstring("simulator UDID", udid)?;
193 let source_name = cstring("camera source", source.kind.as_native_arg())?;
194 let source_arg = cstring(
195 "camera source argument",
196 source.arg.as_deref().unwrap_or(""),
197 )?;
198 let mirror = cstring("camera mirror", mirror.unwrap_or(""))?;
199 let mut error_message = std::ptr::null_mut();
200 let raw = unsafe {
201 ffi::simdeck_camera_switch(
202 udid.as_ptr(),
203 source_name.as_ptr(),
204 source_arg.as_ptr(),
205 mirror.as_ptr(),
206 &mut error_message,
207 )
208 };
209 native_json(raw, error_message, "Unable to switch camera source.")
210}
211
212fn native_stop_camera(udid: &str) -> Result<(), AppError> {
213 let udid = cstring("simulator UDID", udid)?;

Callers 1

switch_cameraFunction · 0.85

Calls 4

cstringFunction · 0.85
simdeck_camera_switchFunction · 0.85
native_jsonFunction · 0.85
as_native_argMethod · 0.80

Tested by

no test coverage detected