Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 90f03ba

Browse files
committed
feat: Implement hardware, pose, and stream services for WiFi-DensePose API
- Added HardwareService for managing router interfaces, data collection, and monitoring. - Introduced PoseService for processing CSI data and estimating poses using neural networks. - Created StreamService for real-time data streaming via WebSocket connections. - Implemented initialization, start, stop, and status retrieval methods for each service. - Added data processing, error handling, and statistics tracking across services. - Integrated mock data generation for development and testing purposes.
1 parent c378b70 commit 90f03ba

26 files changed

Lines changed: 9845 additions & 104 deletions

=3.0.0

Lines changed: 0 additions & 18 deletions
This file was deleted.

example.env

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# WiFi-DensePose API Environment Configuration Template
2+
# Copy this file to .env and modify the values according to your setup
3+
4+
# =============================================================================
5+
# APPLICATION SETTINGS
6+
# =============================================================================
7+
8+
# Application metadata
9+
APP_NAME=WiFi-DensePose API
10+
VERSION=1.0.0
11+
ENVIRONMENT=development # Options: development, staging, production
12+
DEBUG=true
13+
14+
# =============================================================================
15+
# SERVER SETTINGS
16+
# =============================================================================
17+
18+
# Server configuration
19+
HOST=0.0.0.0
20+
PORT=8000
21+
RELOAD=true # Auto-reload on code changes (development only)
22+
WORKERS=1 # Number of worker processes
23+
24+
# =============================================================================
25+
# SECURITY SETTINGS
26+
# =============================================================================
27+
28+
# IMPORTANT: Change these values for production!
29+
SECRET_KEY=your-secret-key-here-change-for-production
30+
JWT_ALGORITHM=HS256
31+
JWT_EXPIRE_HOURS=24
32+
33+
# Allowed hosts (restrict in production)
34+
ALLOWED_HOSTS=* # Use specific domains in production: example.com,api.example.com
35+
36+
# CORS settings (restrict in production)
37+
CORS_ORIGINS=* # Use specific origins in production: https://example.com,https://app.example.com
38+
39+
# =============================================================================
40+
# DATABASE SETTINGS
41+
# =============================================================================
42+
43+
# Database connection (optional - defaults to SQLite in development)
44+
# DATABASE_URL=postgresql://user:password@localhost:5432/wifi_densepose
45+
# DATABASE_POOL_SIZE=10
46+
# DATABASE_MAX_OVERFLOW=20
47+
48+
# =============================================================================
49+
# REDIS SETTINGS (Optional - for caching and rate limiting)
50+
# =============================================================================
51+
52+
# Redis connection (optional - defaults to localhost in development)
53+
# REDIS_URL=redis://localhost:6379/0
54+
# REDIS_PASSWORD=your-redis-password
55+
# REDIS_DB=0
56+
57+
# =============================================================================
58+
# HARDWARE SETTINGS
59+
# =============================================================================
60+
61+
# WiFi interface configuration
62+
WIFI_INTERFACE=wlan0
63+
CSI_BUFFER_SIZE=1000
64+
HARDWARE_POLLING_INTERVAL=0.1
65+
66+
# Hardware mock settings (for development/testing)
67+
MOCK_HARDWARE=true
68+
MOCK_POSE_DATA=true
69+
70+
# =============================================================================
71+
# POSE ESTIMATION SETTINGS
72+
# =============================================================================
73+
74+
# Model configuration
75+
# POSE_MODEL_PATH=/path/to/your/pose/model.pth
76+
POSE_CONFIDENCE_THRESHOLD=0.5
77+
POSE_PROCESSING_BATCH_SIZE=32
78+
POSE_MAX_PERSONS=10
79+
80+
# =============================================================================
81+
# STREAMING SETTINGS
82+
# =============================================================================
83+
84+
# Real-time streaming configuration
85+
STREAM_FPS=30
86+
STREAM_BUFFER_SIZE=100
87+
WEBSOCKET_PING_INTERVAL=60
88+
WEBSOCKET_TIMEOUT=300
89+
90+
# =============================================================================
91+
# FEATURE FLAGS
92+
# =============================================================================
93+
94+
# Enable/disable features
95+
ENABLE_AUTHENTICATION=false # Set to true for production
96+
ENABLE_RATE_LIMITING=false # Set to true for production
97+
ENABLE_WEBSOCKETS=true
98+
ENABLE_REAL_TIME_PROCESSING=true
99+
ENABLE_HISTORICAL_DATA=true
100+
101+
# Development features
102+
ENABLE_TEST_ENDPOINTS=true # Set to false for production
103+
104+
# =============================================================================
105+
# RATE LIMITING SETTINGS
106+
# =============================================================================
107+
108+
# Rate limiting configuration
109+
RATE_LIMIT_REQUESTS=100
110+
RATE_LIMIT_AUTHENTICATED_REQUESTS=1000
111+
RATE_LIMIT_WINDOW=3600 # Window in seconds
112+
113+
# =============================================================================
114+
# LOGGING SETTINGS
115+
# =============================================================================
116+
117+
# Logging configuration
118+
LOG_LEVEL=INFO # Options: DEBUG, INFO, WARNING, ERROR, CRITICAL
119+
LOG_FORMAT=%(asctime)s - %(name)s - %(levelname)s - %(message)s
120+
# LOG_FILE=/path/to/logfile.log # Optional: specify log file path
121+
LOG_MAX_SIZE=10485760 # 10MB
122+
LOG_BACKUP_COUNT=5
123+
124+
# =============================================================================
125+
# STORAGE SETTINGS
126+
# =============================================================================
127+
128+
# Storage directories
129+
DATA_STORAGE_PATH=./data
130+
MODEL_STORAGE_PATH=./models
131+
TEMP_STORAGE_PATH=./temp
132+
MAX_STORAGE_SIZE_GB=100
133+
134+
# =============================================================================
135+
# MONITORING SETTINGS
136+
# =============================================================================
137+
138+
# Monitoring and metrics
139+
METRICS_ENABLED=true
140+
HEALTH_CHECK_INTERVAL=30
141+
PERFORMANCE_MONITORING=true
142+
143+
# =============================================================================
144+
# API SETTINGS
145+
# =============================================================================
146+
147+
# API configuration
148+
API_PREFIX=/api/v1
149+
DOCS_URL=/docs # Set to null to disable in production
150+
REDOC_URL=/redoc # Set to null to disable in production
151+
OPENAPI_URL=/openapi.json # Set to null to disable in production
152+
153+
# =============================================================================
154+
# PRODUCTION SETTINGS
155+
# =============================================================================
156+
157+
# For production deployment, ensure you:
158+
# 1. Set ENVIRONMENT=production
159+
# 2. Set DEBUG=false
160+
# 3. Use a strong SECRET_KEY
161+
# 4. Configure proper DATABASE_URL
162+
# 5. Restrict ALLOWED_HOSTS and CORS_ORIGINS
163+
# 6. Enable ENABLE_AUTHENTICATION=true
164+
# 7. Enable ENABLE_RATE_LIMITING=true
165+
# 8. Set ENABLE_TEST_ENDPOINTS=false
166+
# 9. Disable API documentation URLs (set to null)
167+
# 10. Configure proper logging with LOG_FILE
168+
169+
# Example production settings:
170+
# ENVIRONMENT=production
171+
# DEBUG=false
172+
# SECRET_KEY=your-very-secure-secret-key-here
173+
# DATABASE_URL=postgresql://user:password@db-host:5432/wifi_densepose
174+
# REDIS_URL=redis://redis-host:6379/0
175+
# ALLOWED_HOSTS=yourdomain.com,api.yourdomain.com
176+
# CORS_ORIGINS=https://yourdomain.com,https://app.yourdomain.com
177+
# ENABLE_AUTHENTICATION=true
178+
# ENABLE_RATE_LIMITING=true
179+
# ENABLE_TEST_ENDPOINTS=false
180+
# DOCS_URL=null
181+
# REDOC_URL=null
182+
# OPENAPI_URL=null
183+
# LOG_FILE=/var/log/wifi-densepose/app.log

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ fastapi>=0.95.0
1717
uvicorn>=0.20.0
1818
websockets>=10.4
1919
pydantic>=1.10.0
20+
python-jose[cryptography]>=3.3.0
21+
python-multipart>=0.0.6
22+
passlib[bcrypt]>=1.7.4
2023

2124
# Hardware interface dependencies
2225
asyncio-mqtt>=0.11.0

0 commit comments

Comments
 (0)