Enable profiles switch UI

This commit is contained in:
Janez T
2026-03-16 11:25:51 +01:00
parent fedd7b9a2b
commit 420690d683
30 changed files with 2858 additions and 269 deletions

View File

@@ -1325,6 +1325,31 @@ class ConnectionProvider with ChangeNotifier {
}
}
Future<void> setChannelSlot({
required int channelIdx,
required String channelName,
required Uint8List secret,
}) async {
if (!_activeService.isConnected) {
_error = 'Not connected to device';
notifyListeners();
return;
}
try {
await _activeService.setChannel(
channelIdx: channelIdx,
channelName: channelName,
secret: secret,
);
await _activeService.getChannel(channelIdx);
} catch (e) {
_error = 'Failed to set channel: $e';
notifyListeners();
rethrow;
}
}
/// Generate secret for hash channel using SHA256
/// Same algorithm as Channel model for consistency
/// Python equivalent: hashlib.sha256(channel_name.encode()).digest()[0:16]