printFullStatus method

void printFullStatus(
  1. Map<String, dynamic> statusMap
)

Utility function to display the full status

Implementation

void printFullStatus(Map<String, dynamic> statusMap) {
  if (!statusMap['success']) {
    log('Error obtaining status: ${statusMap['error']}');
    return;
  }

  log('\n==== PRINTER STATUS 3NSTART RPT008 ====');

  if (statusMap.containsKey('printerStatus')) {
    final status = statusMap['printerStatus']['status'];
    log('\n-- GENERAL STATUS --');
    log('Drawer: ${status['drawer']}');
    log('Online: ${status['online'] ? 'Yes' : 'No'}');
    log('Cover open: ${status['coverOpen'] ? 'Yes' : 'No'}');
    log('Manual paper feed: ${status['paperFeed'] ? 'Active' : 'Inactive'}');
    log('Error: ${status['error'] ? 'Yes' : 'No'}');
    log('Received byte: ${status['rawByte']}');
  }

  if (statusMap.containsKey('offlineStatus')) {
    final status = statusMap['offlineStatus']['status'];
    log('\n-- OFFLINE STATUS --');
    log('Cover open: ${status['coverOpen'] ? 'Yes' : 'No'}');
    log('Feed button pressed: ${status['paperFeedStop'] ? 'Yes' : 'No'}');
    log('Error occurred: ${status['errorOccurred'] ? 'Yes' : 'No'}');
    log('Offline: ${status['offline'] ? 'Yes' : 'No'}');
    log('Auto-recoverable error: ${status['autoRecoverableError'] ? 'Yes' : 'No'}');
    log('Waiting to go online: ${status['waitingForOnline'] ? 'Yes' : 'No'}');
    log('Received byte: ${status['rawByte']}');
  }

  if (statusMap.containsKey('errorStatus')) {
    final status = statusMap['errorStatus']['status'];
    log('\n-- ERROR STATUS --');
    log('Mechanical error: ${status['mechanicalError'] ? 'Yes' : 'No'}');
    log('Auto-recoverable error: ${status['autoRecoverError'] ? 'Yes' : 'No'}');
    log('Non-recoverable error: ${status['notRecoverableError'] ? 'Yes' : 'No'}');
    log('Cutter error: ${status['autoRecoverableCutterError'] ? 'Yes' : 'No'}');
    log('Cover open: ${status['coverOpen'] ? 'Yes' : 'No'}');
    log('Out of paper: ${status['paperEmpty'] ? 'Yes' : 'No'}');
    log('Received byte: ${status['rawByte']}');
  }

  if (statusMap.containsKey('paperStatus')) {
    final status = statusMap['paperStatus']['status'];
    log('\n-- PAPER STATUS --');
    log('Paper near end: ${status['paperNearEnd'] ? 'Yes' : 'No'}');
    log('Out of paper: ${status['paperEmpty'] ? 'Yes' : 'No'}');
    log('Stopped due to paper near end: ${status['paperNearEndStop'] ? 'Yes' : 'No'}');
    log('Stopped due to out of paper: ${status['paperEmptyStop'] ? 'Yes' : 'No'}');
    log('Received byte: ${status['rawByte']}');
  }

  log('\n========================================');
}