Skip to main content
DreisamLib is a software development kit (SDK) designed for device connectivity and data interaction. It offers core functionalities including device connection management, real-time and historical data synchronization, and Bluetooth communication control. This SDK is ideal for applications that require seamless integration with compatible medical or IoT devices—particularly continuous glucose monitoring (CGM) systems.

Public Classes and Their Purposes

  1. DreisamLib
    • Main header file. Import all SDK features via #import <DreisamLib/DreisamLib.h>
  2. DreisamLibManage
    • Central management class used to initialize and control the SDK lifecycle
  3. DreisamBuilderParam
    • Builder class for configuring SDK initialization parameters
  4. BleManage
    • Bluetooth module controller. Accessible via [DreisamLibManage shareLib].bleManage
  5. DreisamGlucoseModel
    • Data model representing a glucose reading, including value and timestamp
  6. DreisamEnum
    • Enumerations defining callback status codes and Bluetooth states

SDK Initialization

Initialize the SDK

DreisamBuilderParam *builder = DreisamBuilderParam.new;
builder.hideLog = NO;
builder.appId = @"******";
[[DreisamLibManage shareLib] initSDKBuilderParam:builder];
  • Purpose: Initializes the SDK with required configuration
  • Parameters
    • hideLog - Set to YES to suppress internal logging. Default is NO (logs enabled).
    • appId - Your unique App ID issued from the Dreisam Developer Portal

Deinitialize the SDK

[DreisamLibManage.shareLib releaseUnInit];
  • Purpose: Releases all internal resources held by the SDK.
  • When to Use: Typically called when a user logs out or the app terminates.

Device Connection Management

Connect to a Bluetooth Device

[[DreisamLibManage shareLib].bleManage connectBleDeviceName:deviceName callback:^(DreisamEnumState state) {
    if(state==DreisamEnumStateConnected){
        ///
    }
}];
  • Function: Connect a device with the specified name
  • Parameter: deviceName – The advertised name of the target Bluetooth device

Disconnect from Device

[DreisamLibManage.shareLib.bleManage disconnect];
  • Purpose: Terminates the active Bluetooth connection.
  • Use Case: Trigger during logout or when switching devices.

Get Signal Strength (RSSI)

[[DreisamLibManage shareLib].bleManage getRSSICallback:^(NSNumber *rssi) {

}];

Fetch Historical Data

[[DreisamLibManage shareLib].bleManage getHistoryDataStartTime:1766577042 endTime:1766577642 callBack:^(NSArray<DreisamGlucoseModel *> *glucoseModelAry) {
    NSLog(@"getHistoryDataStartTime %@",glucoseModelAry);
}];
  • Purpose: Retrieves stored glucose readings within a specified time window.
  • Parameters: Unix timestamps (startTime, endTime).

State Monitoring & Callbacks

Bluetooth Connection State

[[DreisamLibManage shareLib].bleManage connectBleStateCallback:^(DreisamEnumState state) {
    if(state==DreisamEnumStateConnected){
      ////////
    }
}];
  • Connection State Enumerations:
    • DreisamEnumStateAuthenticationFailure //Device license verification failed
    • DreisamEnumStateDisconnect //Device disconnected
    • DreisamEnumStateConnected //Successfully connected
    • DreisamEnumStateIndicateLoading //Indicates ongoing operation (e.g., show loading UI)
    • DreisamEnumBleStatePoweredOn //Phone’s Bluetooth is ON
    • DreisamEnumBleStatePoweredOff //Phone’s Bluetooth is OFF

Sync Started

[[DreisamLibManage shareLib].bleManage dataSyncStartCallback:^(int totalCount){
    
}];
  • Callback parameter: totalCount, the amount to synchronize

Sync Progress

[[DreisamLibManage shareLib].bleManage dataSyncProgressCallback:^(**int** progress) {
    NSLog(@"dataSyncProgressCallback = %d",progress);
}];

Sync Completed

[[DreisamLibManage shareLib].bleManage dataSyncCompleteCallback:^(NSArray<DreisamGlucoseModel *> *glucoseModelAry) {
    weakSelf.headerView.dataSyncLabel.text = @"Data sync:100%";
}];

Real-Time Data Updates

[[DreisamLibManage shareLib].bleManage realTimeDataCallBack:^(DreisamGlucoseModel *glucoseModel) {
    weakSelf.headerView.dataSyncLabel.text = @"Data sync:100%";
}];
  • Real-time data is transmitted approximately once every 3 minutes by the device