Appearance
Alerts
Alerts are messages that are sent from SDK to the application when a malfunction occurs. There are two alert categories:
- Warning - indicates a minor, temporary issue that does not interrupt the current operation.
- Error - indicates a severe incident that cannot be resolved by the SDK and results in the termination of any in-progress measurement.
The alert object contains a numeric code that represents a specific issue.
The reasons for warnings and errors can vary - from accuracy problems to incorrect API usage, to license issues or even device-related errors.
Receiving Alerts
In the event that an alert is received, it is recommended to display the numeric alert code in the UI for reference. If the alert is related to a misuse of the SDK or to improper measurement conditions, and the issue persists, please contact the Binah.ai support team via https://www.binah.ai/contact/.
The application can receive alerts by implementing onError and onWarning as part of SessionInfoListener .
Swift
func onSessionStateChange(sessionState: SessionState) {
// Receive session state updates
}
func onWarning(warningData: WarningData) {
// Receive warnings
}
func onError(errorData: ErrorData) {
// Receive errors
}
func onLicenseInfo(licenseInfo: LicenseInfo) {
// Receive license info
}
func onEnabledVitalSigns(enabledVitalSigns: SessionEnabledVitalSigns) {
// Receive the enabled vital signs for the session
}
func onSessionStateChange(sessionState: SessionState) {
// Receive session state updates
}
func onWarning(warningData: WarningData) {
// Receive warnings
}
func onError(errorData: ErrorData) {
// Receive errors
}
func onLicenseInfo(licenseInfo: LicenseInfo) {
// Receive license info
}
func onEnabledVitalSigns(enabledVitalSigns: SessionEnabledVitalSigns) {
// Receive the enabled vital signs for the session
}
Objective-C
- (void)onSessionStateChangeWithSessionState:(BNHSessionState *)sessionState {
// Receive session state updates
}
- (void)onWarningWithData:(BNHWarningData *)warningData {
// Receive warnings
}
- (void)onErrorWithData:(BNHErrorData *)errorData {
// Receive errors
}
- (void)onLicenseInfoWithInfo:(BNHLicenseInfo *)licenseInfo {
// Receive license info
}
- (void)onEnabledVitalSignsWithEnabledVitalSigns:(BNHEnabledVitalSigns *)enabledVitalSigns {
// Receive the enabled vital signs for the session
}
- (void)onSessionStateChangeWithSessionState:(BNHSessionState *)sessionState {
// Receive session state updates
}
- (void)onWarningWithData:(BNHWarningData *)warningData {
// Receive warnings
}
- (void)onErrorWithData:(BNHErrorData *)errorData {
// Receive errors
}
- (void)onLicenseInfoWithInfo:(BNHLicenseInfo *)licenseInfo {
// Receive license info
}
- (void)onEnabledVitalSignsWithEnabledVitalSigns:(BNHEnabledVitalSigns *)enabledVitalSigns {
// Receive the enabled vital signs for the session
}
Important
Note that alert messages are sent on a background thread. The application must switch to the UI thread in order to perform UI updates.
Warnings
A warning indicates a minor, temporary issue. While a warning does not interrupt the measurement, it is encouraged to guide the user on how to avoid such warnings in the future, and to follow the Binah.ai best practices for taking a measurement.
Swift
func onWarning(warningData: WarningData) {
DispatchQueue.main.async {
print("Received Warning. Domain: \(warningData.domain) Code: \(warningData.code)")
}
}
func onWarning(warningData: WarningData) {
DispatchQueue.main.async {
print("Received Warning. Domain: \(warningData.domain) Code: \(warningData.code)")
}
}
Objective-C
- (void)onWarningWithData:(BNHWarningData *)warningData {
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"Received Warning. Domain: %@ Code: %ld", warningData.domain, (long)warningData.code);
});
}
- (void)onWarningWithData:(BNHWarningData *)warningData {
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"Received Warning. Domain: %@ Code: %ld", warningData.domain, (long)warningData.code);
});
}
Errors
An error indicates a severe incident from which the SDK cannot recover. Some of the common reasons for errors include network issues, CPU overload, insufficient lighting, and sub-standard environmental conditions. See the Alerts List for details on each error.
When an error occurs during the measurement, the SDK will terminate any ongoing measurement and will refrain from sending vital sign results to the application. Additionally, the session state will transition from measuring to stopping (see Session States).
Internal Errors
If an invalid SDK internal state occurs during the operation of the SDK, an internal error will be returned to the application. The internal error number may not appear in the Alerts List page. As mentioned earlier, it is advisable to display the error number in the user interface for reference.
If an internal error is received, please report it to the Binah.ai support team at https://www.binah.ai/contact/. Include the error code you received and provide a detailed description of the problem.
Swift
func onError(errorData: ErrorData) {
DispatchQueue.main.async {
print("Received Error. Domain: \(errorData.domain) Code: \(errorData.code)")
}
}
func onError(errorData: ErrorData) {
DispatchQueue.main.async {
print("Received Error. Domain: \(errorData.domain) Code: \(errorData.code)")
}
}
Objective-c
- (void)onErrorWithData:(BNHErrorData *)errorData {
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"Received Error. Domain: %@ Code: %ld", errorData.domain, (long)errorData.code);
});
}
- (void)onErrorWithData:(BNHErrorData *)errorData {
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"Received Error. Domain: %@ Code: %ld", errorData.domain, (long)errorData.code);
});
}