Migration from 1.9.x to 2.0 series

Introduction

For the most part the API's have stayed the same and nothing special is needed to make the transition to Movesense 2.0. However, there are a few areas where the old way of doing things was finally let to rest in favor of a much cleaner API's.

Ble "CustomBleController"

The old way of adjusting some BLE functionality, such as advertising packets, has been removed. Instead use the following:

Advertising & ScanResponse packet manipulation

Use the /Comm/Ble/Adv -API

Sending HRS data

Use the BleStandardHRS-module and it's new Whiteboard API (API-yaml embedded below). There is no need to modify the advertising packet anymore for it to include the HRS ServiceUUID: it happens automatically when the module is loaded.

The API has two methods: POST for updating the HRS notification with new data, and subscription for observing the notification state changes.


paths:

  /Comm/Ble/HRS:
    post:
      description: |
        Send new HR and RR data update to client
      parameters:
        - name: data
          in: body
          description: Update to HRS data
          required: true
          schema:
            $ref: '#/definitions/HRSData'
      responses:
        200:
          description: Operation completed successfully

  /Comm/Ble/HRS/Subscription:
    post:
      description: |
        Subscribe to HRS service state changes.
      responses:
        200:
          description: Operation completed successfully
        x-notification:
          description: new characteristic value
          schema:
            $ref: '#/definitions/HRSState'

    delete:
        description: |
            Unsubscribe from HRS service state changes.
        responses:
          200:
            description: Operation completed successfully

definitions:
  HRSState:
    type: object
    required:
      - notificationEnabled
    properties:
      notificationEnabled:
        type: boolean

  HRSData:
    type: object
    required:
      - hr
    properties:
      hr:
        description: HR value to send in beats per minute
        type: integer
        format: uint16
      rr:
        description: Optional array of RR values in ms
        type: array
        items:
          type: integer
          format: uint16
          x-unit: millisecond

Nordic UART data

Use the BleNordicUART-module and it's new Whiteboard API (API-yaml embedded below).

The API has two methods: POST for sending data over NUS (Nordic UART Service) and SUBSCRIBE to listen the data received.


paths:

  /Comm/Ble/NUS:
    post:
      description: |
        Send data
      parameters:
        - name: data
          in: body
          description: Send data to recipient
          required: true
          schema:
            $ref: '#/definitions/NUSData'
      responses:
        200:
          description: Operation completed successfully
        400:
          description: Data-array too long
        500:
          description: Error sending data
        503:
          description: Client notification not enabled, so cannot send

  /Comm/Ble/NUS/Subscription:
    post:
      description: |
        Subscribe to receive NUS data.
      responses:
        200:
          description: Operation completed successfully
        x-notification:
          description: received data
          schema:
            $ref: '#/definitions/NUSData'

    delete:
        description: |
            Unsubscribe from NUS data.
        responses:
          200:
            description: Operation completed successfully

definitions:
  NUSData:
    type: object
    required:
      - bytes
    properties:
      bytes:
        description: array of data bytes
        type: array
        items:
          type: integer
          format: uint8