Skip to main content

Button Press Event

Handle button press events from smart glasses.

Endpoint

Headers

This endpoint requires glasses authentication, not regular user authentication.

Request Body

Response

When no apps are subscribed to button events:
When apps are subscribed to button events:
Error (500):

Implementation

  • File: packages/cloud/src/routes/hardware.routes.ts:20-59
  • Middleware: validateGlassesAuth
  • Behavior: Creates system photo request if no apps are subscribed to BUTTON_PRESS stream

Button Press Handling Logic

  1. Checks if any apps are subscribed to BUTTON_PRESS events
  2. If no apps subscribed:
    • Creates a system photo request using photoRequestService
    • Returns photo request ID for glasses to take photo
  3. If apps subscribed:
    • Lets apps handle the button press via WebSocket
    • Returns success without action

Check System Photo Request

Check if a system-initiated photo request exists.

Endpoint

Headers

Parameters

Response

Success (200):
Not Found (404):
Error (500):

Implementation

  • File: packages/cloud/src/routes/hardware.routes.ts:66-86
  • Service: Uses photoRequestService.getPendingPhotoRequest()
  • Validation: Only returns requests with origin: 'system'

System Behavior

Default Button Action

When no apps are subscribed to button events:
  1. System creates a photo request with unique ID
  2. Glasses receive instruction to take photo
  3. Photo is uploaded via /api/photos/upload endpoint
  4. Photo is saved to user’s gallery

App-Controlled Buttons

When apps subscribe to button events:
  1. Button press is relayed to subscribed apps via WebSocket
  2. Apps decide what action to take
  3. System takes no default action
  4. Apps can request photos through their own logic

Button Types

Press Types

Error Codes

Notes

  • Button events are a key hardware interaction point
  • System provides default photo-taking behavior
  • Apps can override default behavior by subscribing to BUTTON_PRESS stream
  • Photo requests are managed centrally by photoRequestService
  • All endpoints require glasses authentication
  • The user is identified by email from the decoded JWT token