SimulatorGlassesClient

class SimulatorGlassesClient(activity: AppCompatActivity, displaySink: (String) -> Unit? = null, imageDisplaySink: (Bitmap, DisplayImageOptions) -> Unit? = null, videoPath: String? = null) : BaseGlassesClient

Simulator implementation of GlassesClient that simulates glasses functionality without physical hardware. Designed to run on an Android Emulator.

Behavior:

  • connect()/disconnect(): no physical glasses, so it's effectively a no-op lifecycle.

  • capturePhoto(): uses Android camera (on Android Emulator this can be backed by host webcam), OR reads frames from a local video file when videoPath is set (see --local_video / --url).

  • display(): shows text in the host UI via a sink provided by the host app.

When videoPath is non-null the video is played back at its original frame rate in an infinite loop. Each call to capturePhoto returns the frame that the virtual playback head is currently at.

Constructors

Link copied to clipboard
constructor(activity: AppCompatActivity, displaySink: (String) -> Unit? = null, imageDisplaySink: (Bitmap, DisplayImageOptions) -> Unit? = null, videoPath: String? = null)

Properties

Link copied to clipboard
open override val capabilities: DeviceCapabilities
Link copied to clipboard
Link copied to clipboard
open override val events: Flow<GlassesEvent>
Link copied to clipboard
open override val model: GlassesModel
Link copied to clipboard
open override val state: StateFlow<ConnectionState>

Functions

Link copied to clipboard
open suspend override fun capturePhoto(options: CaptureOptions): Result<CapturedImage>
Link copied to clipboard
suspend override fun connect(): Result<Unit>
Link copied to clipboard
open suspend override fun disconnect()
Link copied to clipboard
open suspend override fun display(text: String, options: DisplayOptions): Result<Unit>
Link copied to clipboard
open suspend override fun displayImage(image: DisplayImage, options: DisplayImageOptions): Result<Unit>
Link copied to clipboard
open suspend override fun playAudio(source: AudioSource, options: PlayAudioOptions): Result<Unit>
Link copied to clipboard

Testing hook that emits a synthetic GlassesEvent.BatteryLevel without glasses hardware.

Link copied to clipboard

Testing hook that emits a synthetic GlassesEvent.LongPress without glasses hardware.

Link copied to clipboard
fun simulateTap(count: Int)

Testing hook that emits a synthetic GlassesEvent.Tap without glasses hardware.

Link copied to clipboard
open suspend override fun startMicrophone(options: MicrophoneOptions): Result<MicrophoneSession>
Link copied to clipboard
open suspend override fun startVideoStream(options: VideoStreamOptions): Result<VideoStreamSession>