Package com.medm.devicekit
Class MedMDeviceKit
- java.lang.Object
-
- com.medm.devicekit.MedMDeviceKit
-
public class MedMDeviceKit extends java.lang.ObjectMain MedM DeviceKit entry point. There are essential entry points to use DeviceKit:-
init(android.app.Application, java.lang.String)you have to initialize Kit with anApplicationobject before usage. -
getScanner()is where you search Bluetooth environment for new devices. -
getDeviceManager()is where you can control devices list: add devices found with scanner, remove devices, list devices, etc. -
getCollector()is where you receive data from controlled devices.
Sample usage:
import com.medm.devicekit.*; public class MyActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { MedMDeviceKit.init(getApplication(), "device-kit-demo-key"); } catch (InvalidLicenseKeyException ex) { ex.printStackTrace(); } } protected void onResume() { super.onResume(); try { MedMDeviceKit.getCollector().start( new IDataCallback() { public void onNewData(IDeviceDescription source, String readingXML) { // Handle new data } public void onDataCollectionStopped() { } }, null // Don't receive updates on device status change ); } catch (MedMDeviceKitNotInitializedException ex) { ex.printStackTrace(); } } } -
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MedMCollectorgetCollector()Gets the collector - an object that controls communication with devices and receives medical data.static MedMDeviceKitConfiggetConfig()Gets current DeviceKit configuration.static MedMDeviceManagergetDeviceManager()Gets the device manager - an object that manages list of connected devices.static MedMScannergetScanner()Gets the scanner - an object that searches new Bluetooth devices to connect.static java.lang.StringgetVersion()Gets DeviceKit version.static voidinit(android.app.Application application, java.lang.String licenseKey)Init MedM DeviceKit with an application objectstatic voidinitFromAssets(android.app.Application application, java.lang.String licenseFileName)Init MedM DeviceKit with an application object and assets pathstatic voidsetConfig(MedMDeviceKitConfig config)Sets DeviceKit configuration.
-
-
-
Method Detail
-
init
public static void init(android.app.Application application, java.lang.String licenseKey) throws InvalidLicenseKeyExceptionInit MedM DeviceKit with an application object- Parameters:
application- application object to provide Context functionalitylicenseKey- licence key, that provided with your copy of MedM DeviceKit library- Throws:
java.lang.IllegalArgumentException- the Application object is nullInvalidLicenseKeyException- the provided licence key is incorrectBuildExpiredException- the distribution is time-limited and expiredLicenseExpiredException- the license is time-limited and expiredUnsupportedPackageException- apps package isn't supported by the provided licenseInitializationFailedException- initialization failed
-
initFromAssets
public static void initFromAssets(android.app.Application application, java.lang.String licenseFileName) throws InvalidLicenseKeyException, java.io.IOExceptionInit MedM DeviceKit with an application object and assets path- Parameters:
application- application object to provide Context functionalitylicenseFileName- path in assets to the licence file provided with your copy of MedM DeviceKit library- Throws:
java.lang.IllegalArgumentException- the Application object is nullInvalidLicenseKeyException- the provided licence key is incorrectBuildExpiredException- the distribution is time-limited and expiredLicenseExpiredException- the license is time-limited and expiredUnsupportedPackageException- apps package isn't supported by the provided licenseInitializationFailedException- initialization failedjava.io.IOException- assets file read failed
-
getScanner
public static MedMScanner getScanner()
Gets the scanner - an object that searches new Bluetooth devices to connect.- Returns:
- the scanner
- Throws:
MedMDeviceKitNotInitializedException- the MedM DeviceKit is not initialized- See Also:
init(android.app.Application, java.lang.String)
-
getDeviceManager
public static MedMDeviceManager getDeviceManager()
Gets the device manager - an object that manages list of connected devices.- Returns:
- the device manager
- Throws:
MedMDeviceKitNotInitializedException- the MedM DeviceKit is not initialized- See Also:
init(android.app.Application, java.lang.String)
-
getCollector
public static MedMCollector getCollector()
Gets the collector - an object that controls communication with devices and receives medical data.- Returns:
- the collector
- Throws:
MedMDeviceKitNotInitializedException- the MedM DeviceKit is not initialized- See Also:
MedMCollector,init(android.app.Application, java.lang.String)
-
getConfig
public static MedMDeviceKitConfig getConfig()
Gets current DeviceKit configuration.- Returns:
- current configuration
- Throws:
MedMDeviceKitNotInitializedException- the MedM DeviceKit is not initialized- See Also:
init(android.app.Application, java.lang.String)
-
setConfig
public static void setConfig(MedMDeviceKitConfig config)
Sets DeviceKit configuration. Note that notification is persistent between app launches.- Parameters:
config- to set- Throws:
MedMDeviceKitNotInitializedException- the MedM DeviceKit is not initialized- See Also:
init(android.app.Application, java.lang.String)
-
getVersion
public static java.lang.String getVersion()
Gets DeviceKit version.- Returns:
- the version identifier
-
-