API reference

MockDeviceKitInterface Protocol

Extends Sendable
Interface for managing mock Meta Wearables devices for testing and development.

Signature

protocol MockDeviceKitInterface: Sendable

Properties

isEnabled : Bool
[Get]
Whether MockDeviceKit is currently enabled.
pairedDevices : [MockDevice]
[Get]
The list of all currently paired mock devices.
permissions : MockPermissions
[Get]
Interface for configuring mock permission behavior.

Functions

disable ()
Disables MockDeviceKit, restoring real providers and unpairing all mock devices.
Signature
public func disable()
enable ( config )
Enables MockDeviceKit, injecting fake providers into the registration and device layers.
Safe to call regardless of whether Wearables.configure() has been called — MockDeviceKit will auto-configure Wearables if needed.
Signature
public func enable( config: MockDeviceKitConfig)
Parameters
config: MockDeviceKitConfig  Configuration options for MockDeviceKit behavior.
pairGlasses ( model )
Pairs a simulated glasses device of the specified model.
Signature
public func pairGlasses( model: GlassesModel) -> MockGlasses
Parameters
model: GlassesModel  The glasses model to simulate.
Returns
MockGlasses  A mock glasses instance.
Throws
startTestServer ( portFilePath )
Starts a local test server for mock device communication.
Signature
public func startTestServer( portFilePath: String?) -> UInt16
Parameters
portFilePath: String?  Optional path to a file where the server port will be written.
Returns
UInt16  The port number the server is listening on.
stopTestServer ()
Stops the running test server.
Signature
public func stopTestServer()
unpairDevice ( device )
Unpairs a simulated device.
Signature
public func unpairDevice(_ device: MockDevice)
Parameters
_ device: MockDevice  The mock device to unpair.