@moshenguo/ms-data-sdk - v0.1.13
    Preparing search index...

    Class BleSDK

    Convert data into firmware commands. Call the corresponding method to get the appropriate command, and send this command to the firmware. The dataParsingWithData method parses the firmware response into an object form.

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    DATA_DELETE: number = 99
    DATA_READ_CONTINUE: number = 2
    DATA_READ_START: number = 0
    DistanceMode_KM: number = 0x80
    DistanceMode_MILE: number = 0x81
    ecgopen: boolean = false
    isRuning: boolean = false
    isSettingSocial: boolean = false
    pregnancyCycleRead: boolean = false
    read: boolean = false
    StartDeviceMeasurementWithType: boolean = false
    TAG: string = "BleSDK"
    TempUnit_C: number = 0x80
    TempUnit_F: number = 0x81
    TimeMode_12h: number = 0x81
    TimeMode_24h: number = 0x80
    WristOn_DisEnable: number = 0x80
    WristOn_Enable: number = 0x81

    Methods

    • Blood Glucose

      Parameters

      • ppgMode: number

        1: start measurement

      • ppgStatus: number

      Returns number[]

    • One-click clear the historical data of the wristband without putting it into sleep mode.

      Returns number[]

    • Disconnect Bluetooth

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Confirm unbind action

      Parameters

      • confirm: boolean

        true = Yes (0x81), false = No (0x80)

      Returns number[]

    • Data parsing method;All returned data resembles a dictionary type. Use data_type to retrieve corresponding data—e.g., GetDetailSleepData indicates sleep data. data represents specific data, which is an array (possibly containing dictionaries). Each array element is a dictionary representing a data point. end indicates whether data collection is complete: true means finished, false means incomplete.

      Parameters

      • value: number[]
      • deviceType: DeviceType = '2208'

      Returns { [key: string]: any }

      The parsed data

    • Delete all alarms

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Delete all HRV test data

      Returns number[]

      {number[]} command packet, to be sent to the firmware

    • Stop blood sugar measurement

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Activity mode control

      Parameters

      • activityMode: number

        Type of activity mode

      • WorkMode: number

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Entering dfu mode

      Returns number[]

    • SOS function

      Returns number[]

    • Entering Take Photo mode

      Returns number[]

    • Get multi-sport mode data

      Parameters

      • mode: number

        0: Start reading from the latest position (up to 50 records) 2: Continue reading from the previous position (when total records exceed 50) 0x99: Delete all GPS data

      Returns number[]

      {number[]} Command packet to send to the device

    • Get alarm clocks

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Get blood oxygen (SpO2) data (automatic measurement)

      Parameters

      • mode: number

        0: Read the most recent data 2: Continue reading from the previous position 99: Delete data

      • time: string

        Date and time in format yyyy-MM-dd HH:mm:ss

      Returns number[]

      {number[]} Command packet to send to the device

    • Read automatic heart rate measurement periods

      Parameters

      • type: number

        1: Read heart rate time settings, 2: Read SpO2 time settings, 4: Read HRV time period settings

      Returns number[]

      {number[]} Command packet to send to the device

    • Manual temperature test data

      Parameters

      • mode: number

        0 - read the latest detailed data, 2 - continue from the last read position, 99 - delete data

      • time: string

        Date string in format yyyy-MM-dd HH:mm:ss

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Get blood oxygen (SpO2) data

      Parameters

      • mode: number

        0: Read the most recent data 2: Continue reading from the previous position 99: Delete data

      • time: string

        Date and time in format yyyy-MM-dd HH:mm:ss

      Returns number[]

      {number[]} Command packet to send to the device

    • Get detailed step data

      Parameters

      • mode: number

        0 - read the latest detailed data, 2 - continue from the last read position, 99 - delete data

      • time: string

        Date string in format yyyy-MM-dd HH:mm:ss

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Get detailed sleep data

      Parameters

      • mode: number

        0 - read the most recent detailed sleep data 2 - continue reading the next segment from the previous position 99 - delete sleep data

      Returns number[]

      {number[]} detailed sleep data

    • Get detailed sleep data

      Parameters

      • mode: number

        0 - read the latest sleep data, 2 - continue from the last read position, 99 - delete sleep data

      • time: string

        Date string in format yyyy-MM-dd HH:mm:ss

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Get device battery level

      Returns number[]

      {number[]} Command packet to send to the device firmware

    • Get basic parameters of the wristband (device information)

      Returns number[]

      Uint8Array Command packet (7 bytes) for sending via BLE

    • Get device MAC address

      Returns number[]

      {number[]} Command packet to send to the device firmware

    • 获取设备名称

      Returns number[]

      {number[]} 指令包(7字节)

    • Get the device time

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Get device firmware version

      Returns number[]

      {number[]} Command packet to send to the device firmware

    • Get heart rate data

      Parameters

      • mode: number

        0: Read the most recent data 2: Continue reading from the previous position 99: Delete data

      • time: string

        Date and time in format yyyy-MM-dd HH:mm:ss

      Returns number[]

      {number[]} Command packet to send to the device

    • Get HRV test data

      Parameters

      • index: number

        Read the data from the first read test. The range is from 0 to 9, and a total of 10 sets of waveforms are saved.

      • time: string

        yyyy-MM-dd HH:mm:ss

      Returns number[]

      {number[]} command packet, to be sent to the firmware

    • Get HRV test data

      Parameters

      • mode: number

        0 - read the most recent detailed data 2 - continue reading the next segment from the previous position 99 - delete data

      • time: string

        yyyy-MM-dd HH:mm:ss

      Returns number[]

      {number[]} command packet, to be sent to the firmware

    • HRV test data

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Get personal information

      Returns number[]

      {number[]} Command packet to send to the firmware

    • PPI data

      Parameters

      • mode: number

        99: Delete PPI data 0: Read the most recent PPI data 1: Read PPI data at a specified position 2: Continue reading the next segment from the last read position

      Returns number[]

      {number[]} command packet, to be sent to the firmware

    • Get detailed sleep data + activity level

      Parameters

      • mode: number

        0: Read the most recent sleep detail data 1: Read sleep detail data at the specified position.
        2: Continue reading the next segment of data from the last read position. 0x99: Delete sleep detail data.

      Returns number[]

      {number[]} Command packet to send to the device

    • Get sedentary reminder settings

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Get Social Distance parameters

      Returns number[]

    • Get single heart rate data (interval heart rate measurement)

      Parameters

      • mode: number

        0: Read the most recent data 2: Continue reading from the previous position 99: Delete data

      • time: string

        Date and time in format yyyy-MM-dd HH:mm:ss

      Returns number[]

      {number[]} Command packet to send to the device

    • Read step goal

      Returns number[]

      {number[]} Command byte array to send to the device

    • Automatic temperature test data

      Parameters

      • mode: number

        0 - read the latest detailed data, 2 - continue from the last read position, 99 - delete data

      • time: string

        Date string in format yyyy-MM-dd HH:mm:ss

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Get total activity data for a specific day

      Parameters

      • mode: number

        Indicates reading from the latest position (up to 50 data sets), 2: continue reading from the last position (when total data > 50), 0x99: delete all activity data

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Get the latest total activity data for a specific date

      Parameters

      • mode: number

        0 - read from the latest position (up to 50 data sets), 2 - continue reading from the last position (when total data > 50), 99 - delete all activity data

      • time: string

        Date string in format yyyy-MM-dd HH:mm:ss

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Health measurement control

      Parameters

      • dataType: number

        Measurement type: 0x01 - HRV(V8 currently does not have a manual measurement function.), 0x02 - Heart rate, 0x03 - Blood oxygen Ox04 - ECG,

      • open: boolean

        1 to start measurement, 0 to stop measurement

      • measurementTime: null | number

        Measurement duration in seconds

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Seniverse weather code → device AA

      Parameters

      • code: string | number

      Returns number

    • Reboot the device

      Returns number[]

      {number[]} Command packet to send to the device firmware

    • Set blood sugar measurement progress

      Parameters

      • progress: number

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Parameters

      • open: boolean

      Returns number[]

      {number[]}

      ECG real-time waveform

      BleSDK

    • Enable or disable real-time step counting mode

      Parameters

      • enable: boolean

        true: start real-time step counting, false: stop real-time step counting

      • tempEnable: boolean

        true: enable real-time temperature, false: disable real-time temperature

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Generate reminder command

      Parameters

      • type: number

        reminder type (0~11, 0xFF = stop call)

      • message: string

        reminder content (max 60 bytes)

      • contact: string

        contact content (max 15 bytes)

      Returns number[]

    • Restore factory settings

      Returns number[]

      {number[]} Command packet to send to the device firmware

    • Send heartbeat packet for activity mode (used with "EnterActivityMode") When the band enters multi-activity mode via the APP, the APP must send a data packet to the band every second, otherwise the band will exit multi-activity mode.

      Parameters

      • distance: number

        Distance in kilometers (floating point)

      • space: number
      • rssi: number

        APP GPS signal strength. Possible values: 1, 2, 3

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Parameters

      • data: number[]
      • isCrc: boolean

      Returns number[]

    • Set all alarms

      Parameters

      • arrayClockAlarm: any[]

        Array of alarm configurations. Each element is an object with the following properties:

        • openOrClose: boolean, whether the alarm is enabled
        • clockType: number, type of alarm (1: standard alarm, 2: medication reminder, 3: water reminder)
        • clockTime: string, alarm time in HH:mm format
        • week: array or bitmask, indicates which weekdays the alarm is active
        • textLength: number, length of the display text
        • text: string, text to display for the alarm

      Returns number[][]

      {number[][]} Command packets to send to the firmware

    • Set the wristband dial mode

      Parameters

      • mode: number

        Dial mode (0, 1, 2... as defined by the device)

      Returns number[]

      {number[]} Command packet (7 bytes)

    • Generate the "Set Device ID" command

      Parameters

      • idBytes: number[]

        number[] 6-byte ID, high byte first

      Returns number[]

      number[] command array ready to send

    • 2025E Device Information Settings Set device information

      Parameters

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Set device information

      Parameters

      • isHeart: boolean

        Flash light when heart rate is too high in exercise mode

      • isMotionDetection: boolean

        Flash light during exercise mode

      • isDay: boolean

        Enable all-day heart rate monitoring

      Returns number[]

    • Set the device name

      Parameters

      • deviceName: string

        Device name (up to 14 ASCII characters)

      Returns number[]

      {number[]} Command packet (7 bytes)

    • Set the device time

      Parameters

      • dateTime: Date

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Set HRV test duration

      Parameters

      • time: number

        Duration of the HRV test

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Set Social Distance parameters

      Parameters

      • interval: number

        Interval value (前提是开关打开设置的参数才生效)扫描时间间隔,单位是分钟。默认是2分钟

      • duration: number

        Duration value 每次扫描时长:单位是秒。现在默认是30S

      • rssi: number

        RSSI threshold 报警信号值:类型是int8,现在默认是-90 单字节带符号。

      Returns number[]

    • Set step goal command

      Parameters

      • stepGoal: number

        Step goal (int, 4 bytes, Big-Endian)

      • targetExecutionTime: number

        Target completion time (minutes) (int, 2 bytes)

      • distance: number

        Distance goal (kilometers) (int, 2 bytes)

      • calorie: number

        Calorie goal (int, 2 bytes)

      • sleepTime: number

        Sleep time goal (minutes) (int, 2 bytes)

      Returns number[]

      number[] Command byte array (16 bytes, including CRC)

    • Start blood sugar measurement

      Returns number[]

      {number[]} Command packet to send to the firmware

    • start PPG realtime waveform transmission

      Parameters

      • isOpen: boolean

      Returns number[]

    • Stop real-time step counting

      Returns number[]

      {number[]} Command packet to send to the firmware

    • Convert text to UTF-8 bytes safely, max 30 bytes, Chinese safe

      Parameters

      • text: string

        Input text

      • maxBytes: number = 30

        Maximum bytes, default 30

      Returns number[]

      number[] Byte array, automatically filled with 0

    • Generate weather update command (Hermes safe)

      Parameters

      • params: {
            address: string;
            aqi: number;
            currentTemp: number;
            maxTemp: number;
            minTemp: number;
            weatherCode: number;
        }

      Returns number[]