Class MedMDeviceManager

java.lang.Object
com.medm.devicekit.MedMDeviceManager

public class MedMDeviceManager extends Object
MedM Device Manager is where you can control devices list: add devices found in scanner, remove devices, list devices, etc.
  • Method Details

    • addDevice

      Start device adding
      Parameters:
      device - device to add
      callback - callback to receive the result when the add operation is finished
      Returns:
      Cancellation token -- could be used to cancel asynchronous add operation
    • addDevice

      public DeviceAddingCancellationToken addDevice(IDeviceDescription device, String pin, IAddDeviceCallback callback)
      Start device adding
      Parameters:
      device - device to add
      pin - Bluetooth pin code to pair device
      callback - callback to receive the result when the add operation is finished
      Returns:
      Cancellation token -- could be used to cancel asynchronous add operation
    • addDeviceManually

      @Deprecated public DeviceAddingCancellationToken addDeviceManually(String address, int sku, IAddDeviceCallback callback)
      Start manual device adding. This is exactly the same as addDevice, but doesn't require IDeviceDescription as argument.
      Parameters:
      address - device bluetooth address
      sku - device sku
      callback - callback to receive the result when the add operation is finished
      Returns:
      Cancellation token -- could be used to cancel asynchronous add operation
    • addDeviceManually

      @Deprecated public DeviceAddingCancellationToken addDeviceManually(String address, int sku, String pin, IAddDeviceCallback callback)
      Start manual device adding. This is exactly the same as addDevice, but doesn't require IDeviceDescription as argument.
      Parameters:
      address - device bluetooth address
      sku - device sku
      pin - Bluetooth pin code to pair device
      callback - callback to receive the result when the add operation is finished or an error if some permissions are missing
      Returns:
      Cancellation token -- could be used to cancel asynchronous add operation
    • addDeviceManually

      public DeviceAddingCancellationToken addDeviceManually(String address, int sku, IAddDeviceWithErrorCallback callback)
      Start manual device adding. This is equal to calling MedMScanner.start() and then addDevice(IDeviceDescription, IAddDeviceCallback)
      Parameters:
      address - device bluetooth address
      sku - device sku
      callback - callback to receive the result when the add operation is finished or an error if some permissions are missing
      Returns:
      Cancellation token -- could be used to cancel asynchronous add operation
    • addDeviceManually

      public DeviceAddingCancellationToken addDeviceManually(String address, int sku, String pin, IAddDeviceWithErrorCallback callback)
      Start manual device adding. This is equal to calling MedMScanner.start() and then addDevice(IDeviceDescription, String, IAddDeviceCallback)
      Parameters:
      address - device bluetooth address
      sku - device sku
      pin - Bluetooth pin code to pair device
      callback - callback to receive the result when the add operation is finished
      Returns:
      Cancellation token -- could be used to cancel asynchronous add operation
    • addDevicePostponed

      public void addDevicePostponed(int sku, PostponedAddFilter filter, String pin)
      Add device for postponed adding. The device would be added once it's found for the first time in collector. The feature is available only for specific licences. Make sure your license includes it.
      Parameters:
      sku - device sku
      filter - filter to identify the exact device
      pin - Bluetooth pin code for this device (if required)
      Throws:
      FeatureUnsupportedException - if the license doesn't include postponed pairing
      FailedToAddPostponedDeviceException - if adding failed
    • removeDevice

      public void removeDevice(String address)
      Remove device from the list of added devices
      Parameters:
      address - bluetooth address of the device to remove
    • removeDevice

      public void removeDevice(IDeviceDescription device)
      Remove device from the list of added devices
      Parameters:
      device - device to remove
    • getDevicesList

      public IDeviceDescription[] getDevicesList()
      Get the list of added devices
      Returns:
      An array of added devices. IDeviceDescription fields that would be provided are SKU, Address, Name, Title, BatteryLevel, LastBatterySyncTime
    • getDevice

      @Nullable public IDeviceDescription getDevice(String address)
      Get the description for the device
      Parameters:
      address - address of the device
      Returns:
      The device description, null if the device isn't found.
    • getSupportedSKUs

      public List<Integer> getSupportedSKUs()
      Get list of SKUs supported by this DeviceKit
      Returns:
      List of supported SKUs
    • getSupportedMeasurementTypes

      public List<MeasurementType> getSupportedMeasurementTypes(int sku)
      Get list of measurement types for the device identified by the SKU.
      Parameters:
      sku - device sku
      Returns:
      List of measurement types
    • getDeviceModelName

      public String getDeviceModelName(int sku)
      Get device model name for the provided sku.
      Parameters:
      sku - device sku
      Returns:
      device model name
    • getDeviceManufacturer

      public String getDeviceManufacturer(int sku)
      Get device manufacturer name for the provided sku.
      Parameters:
      sku - device sku
      Returns:
      device manufacturer