Skip to content
On this page

PPG Device Info

The application can receive info related to the PPG device by using the usePPGDeviceInfo hook. Upon successful initialization and connection with a PPG Device, the SDK sends a PPGDeviceInfo object containing the device type, ID, and version.

  • The info of the connected PPG Device.
TypeScript
import { 
    useSessionErrors
} from 'binah-react-native-sdk';

const {
    deviceInfo, 
    batteryLevel
} = usePPPDeviceInfo(); 

//Handle battery level
React.useEffect(() => {
    if (batteryLevel) {
        console.log(`Device Battery Level: ${batteryLevel}`)
    }
}, [batteryLevel]);

//Handle ppg device info 
React.useEffect(() => {
    if (deviceInfo) {
        console.log(`Device Info: ${deviceInfo.deviceId}, ${deviceInfo.version}`)
    }
}, [deviceInfo]);

The SDK also provides the initial battery level of the device upon connection, as well as any subsequent changes in the device's battery level while the session is active.

TypeScript
import { 
    useSessionErrors
} from 'binah-react-native-sdk';

const {
    deviceInfo, 
    batteryLevel 
} = usePPPDeviceInfo();

//Handle battery level
React.useEffect(() => {
    if (batteryLevel) {
        console.log(`Device Battery Level: ${batteryLevel}`)
    }
}, [batteryLevel]);

//Handle ppg device info
React.useEffect(() => {
    if (deviceInfo) {
        console.log(`Device Info: ${deviceInfo.deviceId}, ${deviceInfo.version}`)
    }
}, [deviceInfo]);