Package com.medm.devicekit
Class MedMDeviceManager
- java.lang.Object
-
- com.medm.devicekit.MedMDeviceManager
-
public class MedMDeviceManager extends java.lang.Object
MedM Device Manager is where you can control devices list: add devices found in scanner, remove devices, list devices, etc.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DeviceAddingCancellationToken
addDevice(IDeviceDescription device, IAddDeviceCallback callback)
Start device addingDeviceAddingCancellationToken
addDevice(IDeviceDescription device, java.lang.String pin, IAddDeviceCallback callback)
Start device addingDeviceAddingCancellationToken
addDeviceManually(java.lang.String address, int sku, IAddDeviceCallback callback)
Start manual device adding.DeviceAddingCancellationToken
addDeviceManually(java.lang.String address, int sku, java.lang.String pin, IAddDeviceCallback callback)
Start manual device adding.void
addDevicePostponed(int sku, PostponedAddFilter filter, java.lang.String pin)
Add device for postponed adding.IDeviceDescription
getDevice(java.lang.String address)
Get the description for the devicejava.lang.String
getDeviceManufacturer(int sku)
Get device manufacturer name for the provided sku.java.lang.String
getDeviceModelName(int sku)
Get device model name for the provided sku.IDeviceDescription[]
getDevicesList()
Get the list of added devicesjava.util.List<MeasurementType>
getSupportedMeasurementTypes(int sku)
Get list of measurement types for the device identified by the SKU.java.util.List<java.lang.Integer>
getSupportedSKUs()
Get list of SKUs supported by this DeviceKitvoid
removeDevice(IDeviceDescription device)
Remove device from the list of added devicesvoid
removeDevice(java.lang.String address)
Remove device from the list of added devices
-
-
-
Method Detail
-
addDevice
public DeviceAddingCancellationToken addDevice(IDeviceDescription device, IAddDeviceCallback callback)
Start device adding- Parameters:
device
- device to addcallback
- 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, java.lang.String pin, IAddDeviceCallback callback)
Start device adding- Parameters:
device
- device to addpin
- Bluetooth pin code to pair devicecallback
- callback to receive the result when the add operation is finished- Returns:
- Cancellation token -- could be used to cancel asynchronous add operation
-
addDeviceManually
public DeviceAddingCancellationToken addDeviceManually(java.lang.String address, int sku, IAddDeviceCallback callback)
Start manual device adding. This is exactly the same as addDevice, but doesn't requireIDeviceDescription
as argument.- Parameters:
address
- device bluetooth addresssku
- device skucallback
- callback to receive the result when the add operation is finished- Returns:
- Cancellation token -- could be used to cancel asynchronous add operation
-
addDeviceManually
public DeviceAddingCancellationToken addDeviceManually(java.lang.String address, int sku, java.lang.String pin, IAddDeviceCallback callback)
Start manual device adding. This is exactly the same as addDevice, but doesn't requireIDeviceDescription
as argument.- Parameters:
address
- device bluetooth addresssku
- device skupin
- Bluetooth pin code to pair devicecallback
- 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, java.lang.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 skufilter
- filter to identify the exact devicepin
- Bluetooth pin code for this device (if required)- Throws:
FeatureUnsupportedException
- if the license doesn't include postponed pairingFailedToAddPostponedDeviceException
- if adding failed
-
removeDevice
public void removeDevice(java.lang.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(java.lang.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 java.util.List<java.lang.Integer> getSupportedSKUs()
Get list of SKUs supported by this DeviceKit- Returns:
- List of supported SKUs
-
getSupportedMeasurementTypes
public java.util.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 java.lang.String getDeviceModelName(int sku)
Get device model name for the provided sku.- Parameters:
sku
- device sku- Returns:
- device model name
-
getDeviceManufacturer
public java.lang.String getDeviceManufacturer(int sku)
Get device manufacturer name for the provided sku.- Parameters:
sku
- device sku- Returns:
- device manufacturer
-
-