flutter_freedome_connectivity 1.0.1
flutter_freedome_connectivity: ^1.0.1 copied to clipboard
FreeDome connectivity and discovery library for Flutter applications
flutter_freedome_connectivity #
FreeDome connectivity and discovery library for Flutter applications.
Features #
- Automatic discovery of FreeDome systems on local network
- Connection management with multiple protocols (Socket.IO, WebSocket, HTTP)
- Real-time event streaming
- Heartbeat monitoring and auto-reconnection
- Network scanning with configurable settings
- Connection status tracking
Installation #
Add this to your package's pubspec.yaml
file:
dependencies:
flutter_freedome_connectivity: ^1.0.0
Usage #
Connection Service #
import 'package:flutter_freedome_connectivity/flutter_freedome_connectivity.dart';
final connectionService = FreeDomeConnectionService();
// Initialize the service
await connectionService.initialize();
// Start discovering systems
await connectionService.startDiscovery();
// Connect to a discovered system
final systems = connectionService.discoveredSystems;
if (systems.isNotEmpty) {
final success = await connectionService.connectToDome(systems.first);
if (success) {
print('Connected to: ${connectionService.activeDome?.name}');
}
}
// Listen to events
connectionService.eventStream.listen((event) {
print('Event: ${event.type} - ${event.data}');
});
Discovery Service #
final discoveryService = FreeDomeDiscoveryService();
// Start discovery
await discoveryService.startDiscovery();
// Listen to discovered systems
discoveryService.systemsStream.listen((systems) {
for (final system in systems) {
print('Found system: ${system.name} at ${system.ipAddress}:${system.port}');
}
});
// Check if system is available
final isAvailable = await discoveryService.isSystemAvailable(system);
Sending Commands #
// Send command to connected system
final response = await connectionService.sendCommand(
FreeDomeCommand(
type: 'play_video',
data: {'video_id': '123', 'quality': 'hd'},
targetSystemId: connectionService.activeDome?.id,
timestamp: DateTime.now(),
),
);
if (response.success) {
print('Command sent successfully');
} else {
print('Command failed: ${response.error}');
}
API Reference #
Models #
DomeSystem
- Represents a FreeDome systemFreeDomeConnectionStatus
- Connection status informationFreeDomeEvent
- Real-time events from systemsFreeDomeCommand
- Commands to send to systemsFreeDomeResponse
- Responses from systemsDiscoverySettings
- Configuration for network discovery
Services #
FreeDomeConnectionService
- Main connection managementFreeDomeDiscoveryService
- Network discovery service
Enums #
DomeSystemStatus
- System status (offline, online, maintenance, error)
License #
MIT License - see LICENSE file for details.