Skip to main content

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

tts

Text-to-speech service layer wrapping expo-speech

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

Content type
application/json
{
  • "text": "I want water"
}

Stop current speech

Immediately stops any ongoing speech playback.

Responses

WordGrid

Scrollable grid component for displaying and selecting word tiles

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

Content type
application/json
{
  • "words": [
    ],
  • "activeCategoryColor": "#4CAF50",
  • "onAddWord": "addWord"
}

SentenceBar

Horizontal bar component for displaying and managing the built sentence

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

Content type
application/json
{
  • "sentence": [
    ],
  • "onRemoveLastWord": "string",
  • "onClearSentence": "string",
  • "onSpeakSentence": "string"
}

RoomSelector

Room chip selector component — manual BLE placeholder

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

Content type
application/json
{
  • "rooms": [
    ],
  • "activeRoomId": "kitchen",
  • "onSelectRoom": "string"
}

InteractionLogModal

Full-screen modal for viewing and exporting interaction logs

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

Content type
application/json
{
  • "visible": true,
  • "logs": [
    ],
  • "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

Content type
application/json
{
  • "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
deviceId
string
buttonName
string
pressedAt
string <date-time>
object
word
string
sentenceLength
integer
category
string

Responses

Request samples

Content type
application/json
{
  • "logs": [
    ]
}

CategoryTabs

Tab bar component for selecting word categories

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

Content type
application/json
{
  • "categories": {
    },
  • "activeCategory": "Drinks",
  • "categoryColors": {
    },
  • "onSelectCategory": "string"
}

AppHeader

Top header bar component showing room context and log access

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

Content type
application/json
{
  • "currentRoom": {
    },
  • "onViewLogs": "string"
}

useSpeech

Custom hook exposing TTS controls to components

Initialize the speech hook

Custom hook that wraps the TTS service and exposes speakText and stopSpeech helpers to React components.

Responses

Response samples

Content type
application/json
{
  • "speakText": "string",
  • "stopSpeech": "string"
}

useSentenceBuilder

Custom hook for sentence state management with interaction logging

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

Content type
application/json
{
  • "onLogPress": "logButtonPress"
}

Response samples

Content type
application/json
{
  • "sentence": [
    ],
  • "addWord": "string",
  • "removeLastWord": "string",
  • "clearSentence": "string",
  • "speakSentence": "string"
}

Append a word to the sentence

Appends a word to the current sentence array and logs a word_tile press event.

Request Body schema: application/json
word
required
string

Responses

Request samples

Content type
application/json
{
  • "word": "water"
}

Remove the last word from the sentence

Removes the last word in the sentence array and logs a remove_last_word event.

Responses

Clear the entire sentence

Resets the sentence array to empty and logs a clear_sentence event.

Responses

Speak the full sentence

Shows a native Alert with the full sentence joined by spaces and logs a speak_sentence event. No-op if the sentence is empty.

Responses

useSentence

Custom hook for sentence state management with integrated TTS feedback

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

Content type
application/json
{
  • "sentence": [
    ],
  • "addWord": "string",
  • "speakSentence": "string",
  • "clear": "string"
}

Append a word and speak it immediately

Appends a word to the sentence array and immediately speaks that word via TTS.

Request Body schema: application/json
word
required
string

Responses

Request samples

Content type
application/json
{
  • "word": "hungry"
}

Speak the full sentence

Joins all words with spaces and passes the result to the TTS speak function.

Responses

Clear sentence and stop speech

Resets the sentence array to empty and calls TTS stop to halt any ongoing speech.

Responses

useLocationDetection

Custom hook abstracting room/location detection with BLE upgrade path

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

Content type
application/json
{
  • "currentRoom": {
    },
  • "detectionMode": "manual",
  • "setRoomManually": "string",
  • "allRooms": [
    ]
}

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

Content type
application/json
{
  • "roomId": "kitchen"
}

useInteractionLogger

Custom hook for recording and managing user interaction log entries

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)
id
string
label
string
emoji
string
color
string

Responses

Request samples

Content type
application/json
{
  • "currentRoom": {
    }
}

Response samples

Content type
application/json
{
  • "deviceId": "ios-17-x4f2a9b3",
  • "interactionLogs": [
    ],
  • "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

Content type
application/json
{
  • "buttonName": "word_tile",
  • "metadata": {
    }
}

Generate a pseudo-unique device identifier

Builds a device ID string in the format {os}-{version}-{randomSuffix} using Platform.OS, Platform.Version, and a random base-36 suffix. Called once on hook mount.

Responses

Response samples

Content type
application/json
{
  • "deviceId": "ios-17-x4f2a9b3"
}