VitalSnap Operations

React Native ==> VitalSnap module

Taking a Reading

You can take a reading from any supported peripheral device using ValidicVitalSnap:

ValidicVitalSnap.takeReading(1)
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error(error);
  });

For any peripheral that supports multiple units, you can specify the units at runtime for a given reading. If no unit is provided, a default unit is assumed.

ValidicVitalSnap.takeReading(32, VitalSnapTemperatureUnit.Fahrenheit)
  .then(result => {
    console.log(result);
  })
  .catch(error => {
    console.error(error);
  });

Submit a Reading

After taking a reading, submit the result to Validic using ValidicCore.submit() from @validic-mobile/react-native-inform-core. The VitalSnapResult contains an informRecord and an image (base64-encoded) that can be passed directly to the submit method.

import { ValidicCore } from '@validic-mobile/react-native-inform-core';
import { ValidicVitalSnap } from '@validic-mobile/react-native-inform-vitalsnap';

// Take a reading and submit it
ValidicVitalSnap.takeReading(3)
  .then(result => {
    // Submit the record along with the captured image
    ValidicCore.submit(result.informRecord, result.image);
  })
  .catch(error => {
    console.error(error);
  });