Report hotspot config

This commit is contained in:
nemunaire 2026-01-01 17:32:46 +07:00
commit c443fce24f
8 changed files with 244 additions and 160 deletions

View file

@ -133,42 +133,6 @@ paths:
schema:
$ref: '#/components/schemas/Error'
/api/hotspot/config:
post:
tags:
- Hotspot
summary: Configure hotspot settings
description: |
Updates the hotspot (access point) configuration including SSID, password,
and WiFi channel. Changes are written to hostapd configuration file.
The hotspot needs to be restarted for changes to take effect.
operationId: configureHotspot
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/HotspotConfig'
responses:
'200':
description: Configuration updated successfully
content:
application/json:
schema:
$ref: '#/components/schemas/SuccessResponse'
'400':
description: Invalid configuration data
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'500':
description: Configuration update failed
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
/api/hotspot/toggle:
post:
tags:
@ -176,7 +140,8 @@ paths:
summary: Toggle hotspot on/off
description: |
Enables or disables the hotspot (access point) by starting/stopping
the hostapd service. Returns the new enabled state.
the hostapd service. Returns the new enabled state and updates
the system status with current hostapd_cli information.
operationId: toggleHotspot
responses:
'200':
@ -242,7 +207,8 @@ paths:
summary: Get system status
description: |
Returns comprehensive system status including WiFi connection state,
hotspot status, connected device count, data usage, and uptime.
detailed hotspot status from hostapd_cli, connected device count,
data usage, and uptime.
operationId: getStatus
responses:
'200':
@ -367,32 +333,48 @@ components:
- ssid
- password
HotspotConfig:
HotspotStatus:
type: object
description: Hotspot (access point) configuration
description: Detailed hotspot status from hostapd_cli
properties:
state:
type: string
description: Hotspot state (ENABLED, DISABLED, etc.)
example: "ENABLED"
ssid:
type: string
description: Hotspot SSID (network name)
minLength: 1
maxLength: 32
description: Current SSID being broadcast
example: "TravelRouter"
password:
bssid:
type: string
description: WPA2 password (minimum 8 characters)
minLength: 8
maxLength: 63
example: "secure123"
description: MAC address of the access point
pattern: '^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$'
example: "4a:e3:4e:09:57:f8"
channel:
type: integer
description: WiFi channel (1-11 for 2.4GHz)
description: Current WiFi channel
minimum: 1
maximum: 14
example: 6
example: 11
frequency:
type: integer
description: Frequency in MHz
example: 2462
numStations:
type: integer
description: Number of connected stations
minimum: 0
example: 2
hwMode:
type: string
description: Hardware mode (g, a, n, ac, etc.)
example: "g"
countryCode:
type: string
description: Country code
example: "VN"
required:
- ssid
- password
- channel
- state
ConnectedDevice:
type: object
@ -440,10 +422,11 @@ components:
type: string
description: SSID of connected upstream network (empty if not connected)
example: "Hotel-Guest"
hotspotEnabled:
type: boolean
description: Whether the hotspot is currently enabled
example: true
hotspotStatus:
allOf:
- $ref: '#/components/schemas/HotspotStatus'
nullable: true
description: Detailed hotspot status (null if hotspot is not running)
connectedCount:
type: integer
description: Number of devices connected to hotspot
@ -452,7 +435,7 @@ components:
dataUsage:
type: number
format: double
description: Total data usage in MB (placeholder for future implementation)
description: Total data usage in MB
example: 145.7
uptime:
type: integer
@ -467,7 +450,6 @@ components:
required:
- connected
- connectedSSID
- hotspotEnabled
- connectedCount
- dataUsage
- uptime