API 1 - Location Aware AAC Device
AAC Beacon - Source Documentation (1.0.0)
Download OpenAPI specification:Download
This document describes the functions, hooks, and components of the AAC Beacon React Native application using the OpenAPI 3.0 specification format as a structured reference for all exported modules.
Each tag corresponds to a source file. Each path corresponds to a callable function or hook. Parameters map to function arguments and responses map to return values or side effects.
Source files covered:
- tts.js
- WordGrid.js
- SentenceBar.js
- RoomSelector.js
- InteractionLogModal.js
- CategoryTabs.js
- AppHeader.js
- useSpeech.js
- useSentenceBuilder.js
- useSentence.js
- useLocationDetection.js
- useInteractionLogger.js
Speak text aloud
Speaks the given text using the device speech engine (expo-speech). Stops any currently playing speech before starting a new utterance. Does nothing if the text is empty or whitespace only. Language is en-US, rate 0.9, pitch 1.0.
Request Body schema: application/json
| text required | string The text to be spoken aloud |
Responses
Request samples
- Payload
{- "text": "I want water"
}Render the word tile grid
Renders a scrollable grid of word tiles. Each tile displays an emoji and a label. Pressing a tile invokes the onAddWord callback with the word label. Tile background is tinted and bordered using the active category color.
Request Body schema: application/json
required | Array of objects (Word) |
| activeCategoryColor required | string Hex color string for tile tint and border |
| onAddWord required | string Callback reference — (label: string) => void |
Responses
Request samples
- Payload
{- "words": [
- {
- "label": "water",
- "emoji": "💧"
}
], - "activeCategoryColor": "#4CAF50",
- "onAddWord": "addWord"
}Render the sentence bar
Renders a horizontal bar showing the current sentence as individual word chips, along with backspace, clear, and speak action buttons. Displays a placeholder when the sentence is empty.
Request Body schema: application/json
| sentence required | Array of strings |
| onRemoveLastWord required | string Callback reference — () => void |
| onClearSentence required | string Callback reference — () => void |
| onSpeakSentence required | string Callback reference — () => void |
Responses
Request samples
- Payload
{- "sentence": [
- "I",
- "want",
- "water"
], - "onRemoveLastWord": "string",
- "onClearSentence": "string",
- "onSpeakSentence": "string"
}Render the room selector chip row
Renders a horizontally scrollable row of room chips for manually simulating room entry. Includes a "General" chip to clear the room context. This component is a placeholder for Bluetooth beacon detection — once BLE is integrated it can be hidden or used as a manual override only.
Request Body schema: application/json
required | Array of objects (Room) |
| activeRoomId required | string or null |
| onSelectRoom required | string Callback reference — (roomId: string | null) => void |
Responses
Request samples
- Payload
{- "rooms": [
- {
- "id": "kitchen",
- "label": "Kitchen",
- "emoji": "🍳",
- "color": "#FF6B6B"
}
], - "activeRoomId": "kitchen",
- "onSelectRoom": "string"
}Render the interaction log modal
Renders a full-screen modal displaying all recorded interaction log entries in reverse chronological order. Includes an Export JSON button that triggers a file download on web or the native share sheet on mobile. The export button is disabled when there are no logs.
Request Body schema: application/json
| visible required | boolean |
required | Array of objects (LogEntry) |
| onClose required | string Callback reference — () => void |
Responses
Request samples
- Payload
{- "visible": true,
- "logs": [
- {
- "deviceId": "android-33-ab12cd34",
- "buttonName": "word_tile",
- "pressedAt": "2024-05-01T10:30:00.000Z",
- "location": {
- "id": "kitchen",
- "label": "Kitchen"
}, - "word": "water",
- "sentenceLength": 3,
- "category": "Drinks"
}
], - "onClose": "string"
}Format a timestamp value to a locale string
Converts a timestamp value to a human-readable locale date/time string. Returns the original value unchanged if it cannot be parsed as a valid Date.
query Parameters
| value required | string Example: value=2024-05-01T10:30:00.000Z An ISO date string or numeric timestamp to format |
Responses
Response samples
- 200
{- "result": "5/1/2024, 10:30:00 AM"
}Export interaction logs as JSON
Serializes all log entries into a JSON payload with metadata (exportedAt, totalLogs). On web platforms, triggers a file download. On native platforms, opens the system share sheet. Disables itself while an export is in progress. No-op if there are no logs.
Request Body schema: application/json
Array of objects (LogEntry) | |||||||||||||||
Array
| |||||||||||||||
Responses
Request samples
- Payload
{- "logs": [
- {
- "deviceId": "android-33-ab12cd34",
- "buttonName": "word_tile",
- "pressedAt": "2024-05-01T10:30:00.000Z",
- "location": {
- "id": "kitchen",
- "label": "Kitchen"
}, - "word": "water",
- "sentenceLength": 3,
- "category": "Drinks"
}
]
}Render category tab buttons
Renders a row of tappable category tabs. The active tab is highlighted with its assigned category color. Pressing a tab invokes onSelectCategory.
Request Body schema: application/json
| categories required | object Object whose keys are category name strings |
| activeCategory required | string |
| categoryColors required | object Map of category keys to hex color strings |
| onSelectCategory required | string Callback reference — (category: string) => void |
Responses
Request samples
- Payload
{- "categories": {
- "Drinks": [ ],
- "Food": [ ],
- "Feelings": [ ]
}, - "activeCategory": "Drinks",
- "categoryColors": {
- "Drinks": "#2196F3",
- "Food": "#4CAF50"
}, - "onSelectCategory": "string"
}Render the app header bar
Renders the top header showing the AAC Beacon title, the current room context (emoji + label, or "General" if no room is set), and a "View Logs" button.
Request Body schema: application/json
object (Room) | |
| onViewLogs required | string Callback reference — () => void |
Responses
Request samples
- Payload
{- "currentRoom": {
- "id": "kitchen",
- "label": "Kitchen",
- "emoji": "🍳",
- "color": "#FF6B6B"
}, - "onViewLogs": "string"
}Initialize the sentence builder hook
Custom hook that manages sentence state and logs every sentence-related user action via the provided onLogPress callback. Intended as the primary sentence hook when interaction logging is required.
Request Body schema: application/json
| onLogPress | string Callback reference — (buttonName, metadata?) => void |
Responses
Request samples
- Payload
{- "onLogPress": "logButtonPress"
}Response samples
- 200
{- "sentence": [
- "I",
- "want",
- "water"
], - "addWord": "string",
- "removeLastWord": "string",
- "clearSentence": "string",
- "speakSentence": "string"
}Initialize the sentence hook with TTS feedback
Custom hook managing sentence state with immediate TTS feedback on each word added. Also supports speaking the full sentence on demand and clearing with speech stopped.
Responses
Response samples
- 200
{- "sentence": [
- "I",
- "am",
- "hungry"
], - "addWord": "string",
- "speakSentence": "string",
- "clear": "string"
}Initialize the location detection hook
Abstraction layer for room/location detection. Currently operates in manual mode via setRoomManually. Designed so that Bluetooth beacon scanning can replace the internals in the future without changing the hook's return shape or any consuming components.
Responses
Response samples
- 200
{- "currentRoom": {
- "id": "kitchen",
- "label": "Kitchen",
- "emoji": "🍳",
- "color": "#FF6B6B"
}, - "detectionMode": "manual",
- "setRoomManually": "string",
- "allRooms": [
- {
- "id": "kitchen",
- "label": "Kitchen",
- "emoji": "🍳",
- "color": "#FF6B6B"
}
]
}Manually set the active room by ID
Looks up a room by ID from the full rooms list and sets it as the current room. Pass null to clear the active room and revert to General.
Request Body schema: application/json
| roomId | string or null The ID of the room to activate, or null to clear |
Responses
Request samples
- Payload
{- "roomId": "kitchen"
}Initialize the interaction logger hook
Custom hook that maintains a session-scoped log of user interaction events. Generates a pseudo-unique device ID on mount combining platform OS, version, and a random suffix. Each logged entry captures the button name, ISO timestamp, device ID, room context, and any extra metadata fields.
Request Body schema: application/json
object (Room) | |||||||||
| |||||||||
Responses
Request samples
- Payload
{- "currentRoom": {
- "id": "kitchen",
- "label": "Kitchen",
- "emoji": "🍳",
- "color": "#FF6B6B"
}
}Response samples
- 200
{- "deviceId": "ios-17-x4f2a9b3",
- "interactionLogs": [
- {
- "deviceId": "android-33-ab12cd34",
- "buttonName": "word_tile",
- "pressedAt": "2024-05-01T10:30:00.000Z",
- "location": {
- "id": "kitchen",
- "label": "Kitchen"
}, - "word": "water",
- "sentenceLength": 3,
- "category": "Drinks"
}
], - "logButtonPress": "string"
}Record a new interaction log entry
Creates and appends a new log entry to the interactionLogs array. The entry merges deviceId, buttonName, pressedAt (ISO string), location (derived from currentRoom), and any extra fields from metadata. Also prints the entry to the console via JSON.stringify.
Request Body schema: application/json
| buttonName required | string Identifier of the button or action triggered |
| metadata | object Optional additional fields merged into the log entry |
Responses
Request samples
- Payload
{- "buttonName": "word_tile",
- "metadata": {
- "word": "water",
- "sentenceLength": 3,
- "category": "Drinks"
}
}