cleanInactiveDevices method

void cleanInactiveDevices(
  1. DateTime now
)

Implementation

void cleanInactiveDevices(DateTime now) {
  deviceList.removeWhere((key, device) {
    final inactiveDuration = now.difference(device.activeTime).inSeconds;
    return inactiveDuration > 120; // 超过120秒未活跃
  });
}