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: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_PRESSstream
Button Press Handling Logic
- Checks if any apps are subscribed to
BUTTON_PRESSevents - If no apps subscribed:
- Creates a system photo request using
photoRequestService - Returns photo request ID for glasses to take photo
- Creates a system photo request using
- 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):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:- System creates a photo request with unique ID
- Glasses receive instruction to take photo
- Photo is uploaded via
/api/photos/uploadendpoint - Photo is saved to user’s gallery
App-Controlled Buttons
When apps subscribe to button events:- Button press is relayed to subscribed apps via WebSocket
- Apps decide what action to take
- System takes no default action
- 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_PRESSstream - Photo requests are managed centrally by
photoRequestService - All endpoints require glasses authentication
- The user is identified by email from the decoded JWT token