setConnectionChecker method
void
setConnectionChecker({})
Implementation
void setConnectionChecker(
{Duration timeout = const Duration(seconds: 12),
Duration interval = const Duration(seconds: 45),
required Function retry}) {
socketService.setConnectionChecker(
timeout: timeout,
deviceQueryDeviceName: '',
interval: interval,
shouldCheck :()=>modded,
useRetryResponse: (v) {
if (v is DeviceStatusResponse) {
if (v.result.toLowerCase() == "ok" || v.result.toLowerCase() == "") {
// print(deviceStatusRes.status.map((e) => e.toXML()).toList());
if (v.status.where((element) => element.toXML().contains("${getType.name}Status")).isNotEmpty) {
// print("Status DETECTED");
deviceParameter.status = v.status.firstWhere((element) => element.toXML().contains("${getType.name}Status"));
CUPPS().notifier!();
return CuppsCommandResponse(status: true, msg: "Device :$deviceName Status Refreshed");
}
}
}
},
retryFunction: () {
if (!isPrinting) {
retry();
}
});
}