startHeartbeatMonitoring method

void startHeartbeatMonitoring(
  1. SmartphoneDeploymentController controller
)

Start heartbeat monitoring for this device for the deployment controlled by controller.

Implementation

void startHeartbeatMonitoring(SmartphoneDeploymentController controller) {
  if (!isInitialized) {
    warning(
        '$runtimeType - Trying to start heartbeat monitoring before device is initialized. '
        'Please initialize device first.');
    return;
  }
  debug(
      '$runtimeType - Setting up heartbeat monitoring for device: $configuration');
  _heartbeatTimer = Timer.periodic(
      const Duration(minutes: DeviceController.HEARTBEAT_PERIOD),
      (_) => (isConnected)
          ? controller.executor.addMeasurement(Measurement.fromData(Heartbeat(
              period: DeviceController.HEARTBEAT_PERIOD,
              deviceType: configuration!.type,
              deviceRoleName: configuration!.roleName)))
          : null);
}