mockdevice-testing

โดย facebook

MockDeviceKit สำหรับการทดสอบโดยไม่ต้องใช้ฮาร์ดแวร์แว่นตาจริง

npx skills add https://github.com/facebook/meta-wearables-dat-ios --skill mockdevice-testing

MockDevice Testing (iOS)

Use MockDeviceKit to test DAT SDK integrations without physical Meta glasses.

MockDeviceKit simulates Meta glasses behavior for development and testing. It provides:

  • MockDeviceKit — Entry point for creating simulated devices
  • MockGlasses — Simulated glasses (Ray-Ban Meta, etc.)
  • MockCameraKit — Simulated camera with configurable video feed and photo capture

Setup

Add MWDATMockDevice to your target via Swift Package Manager (it's included in the meta-wearables-dat-ios package).

import MWDATMockDevice

Creating a mock device

import MWDATMockDevice

let mockDeviceKit = MockDeviceKit.shared
mockDeviceKit.enable()

let mockDevice = try mockDeviceKit.pairGlasses(model: .rayBanMeta)

Simulating device states

// Simulate glasses lifecycle
mockDevice.powerOn()
mockDevice.unfold()
mockDevice.don()    // Simulate wearing the glasses

// Later...
mockDevice.doff()   // Simulate removing
mockDevice.fold()
mockDevice.powerOff()

Configuring permissions

MockDeviceKit provides permissions to control permission behavior without the Meta AI app.

By default, requestPermission() returns .granted. Use set(_:_:) to control checkPermissionStatus() and setRequestResult(_:result:) to control requestPermission() outcomes.

let mockDeviceKit = MockDeviceKit.shared

// Simulate denied camera permission status
mockDeviceKit.permissions.set(.camera, .denied)

// Simulate denied request result (user tapping "deny")
mockDeviceKit.permissions.setRequestResult(.camera, result: .denied)

Setting up mock camera feeds

Video streaming

let camera = mockDevice.services.camera
camera.setCameraFeed(fileURL: videoURL)

Photo capture

let camera = mockDevice.services.camera
camera.setCapturedImage(fileURL: imageURL)

Writing tests with MockDeviceKit

Create a reusable test base class:

import XCTest
import MetaWearablesDAT

@MainActor
class MockDeviceKitTestCase: XCTestCase {
    private var mockDevice: MockGlasses?
    private var cameraKit: MockCameraKit?

    override func setUp() async throws {
        try await super.setUp()
        MockDeviceKit.shared.enable()
        mockDevice = try MockDeviceKit.shared.pairGlasses(model: .rayBanMeta)
        cameraKit = mockDevice?.services.camera // mockDevice is MockGlasses? for tearDown nil-ability
    }

    override func tearDown() async throws {
        MockDeviceKit.shared.disable()
        mockDevice = nil
        cameraKit = nil
        try await super.tearDown()
    }
}

Using MockDeviceKit in the CameraAccess sample

The CameraAccess sample app includes a Debug menu for MockDeviceKit:

  1. Tap the Debug icon to open the MockDeviceKit menu
  2. Tap Pair RayBan Meta to create a simulated device
  3. Use PowerOn, Unfold, Don to simulate glasses states
  4. Select video/image files to configure mock camera feeds
  5. Start streaming to see simulated frames

Supported media formats

TypeFormats
Videoh.265 (HEVC)
ImageJPEG, PNG

Links

Skills เพิ่มเติมจาก facebook

api-health
facebook
Monitor API health for a Meta app — check rate limits, call volume, and API deprecations. Use to diagnose throttling, plan capacity, or prepare for API version…
official
api-integration
facebook
แนะนำนักพัฒนาในการตั้งค่าการเชื่อมต่อ Meta API ตั้งแต่เริ่มต้น — ค้นหา API ที่เหมาะสม ดึงคู่มือการตั้งค่า ข้อกำหนดการยืนยันตัวตน…
official
app-review-prep
facebook
เตรียมแอป Meta สำหรับ App Review — ตรวจสอบสถานะปัจจุบัน ข้อกำหนดที่ค้างอยู่ สิทธิ์ที่ได้รับ และประวัติการส่ง ใช้ก่อนส่งแอป…
official
debug-webhooks
facebook
แก้ไขปัญหาเว็บฮุคสำหรับแอป Meta — ตรวจสอบการสมัครใช้งานที่ใช้งานอยู่ ระบุการตั้งค่าที่ผิดพลาด และส่งเพย์โหลดทดสอบเพื่อยืนยันการส่งมอบ ใช้เมื่อ…
official
webhook-setup
facebook
Set up webhooks for a Meta app end-to-end — discover available topics, subscribe to fields, and verify with a test payload. Use when configuring webhooks for…
official
buck2-rule-basics
facebook
แนะนำผู้ใช้ผ่านการเขียนกฎ Buck2 ตัวแรก เพื่อเรียนรู้แนวคิดพื้นฐาน ได้แก่ กฎ แอ็กชัน เป้าหมาย คอนฟิกูเรชัน การวิเคราะห์ และ select() ใช้…
official
add-ir-instruction
facebook
Guide for adding a new IR instruction to the Hermes compiler. Use when the user asks to add, create, or define a new IR instruction (Inst/Instruction) in the…
official
binary-size-analysis
facebook
ทักษะนี้ควรใช้เมื่อผู้ใช้ต้องการวิเคราะห์การเปลี่ยนแปลงขนาดไบนารีของ hermesvm ในช่วงของคอมมิต ใช้เมื่อผู้ใช้กล่าวถึง "binary size",…
official