Package com.medm.devicekit
Class MedMDeviceKit
java.lang.Object
com.medm.devicekit.MedMDeviceKit
Main 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
Modifier and TypeMethodDescriptionstatic voidenableLogs(boolean enabled) Enable or disable logs.static BluetoothStateGets a bluetooth statestatic MedMCollectorGets the collector - an object that controls communication with devices and receives medical data.static MedMDeviceKitConfigGets current DeviceKit configuration.static MedMDeviceManagerGets the device manager - an object that manages list of connected devices.static MedMScannerGets the scanner - an object that searches new Bluetooth devices to connect.static StringGets DeviceKit version.static voidInit MedM DeviceKit with an application objectstatic voidinitFromAssets(android.app.Application application, String licenseFileName) Init MedM DeviceKit with an application object and assets pathstatic booleanstatic booleanstatic voidsetConfig(MedMDeviceKitConfig config) Sets DeviceKit configuration. 
- 
Method Details
- 
isInitialized
public static boolean isInitialized() - 
init
public static void init(android.app.Application application, String licenseKey) throws InvalidLicenseKeyException Init 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:
 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, String licenseFileName) throws InvalidLicenseKeyException, IOException Init 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:
 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 failedIOException- assets file read failed
 - 
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:
 
 - 
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:
 
 - 
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:
 
 - 
getConfig
Gets current DeviceKit configuration.- Returns:
 - current configuration
 - Throws:
 MedMDeviceKitNotInitializedException- the MedM DeviceKit is not initialized- See Also:
 
 - 
setConfig
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:
 
 - 
getVersion
Gets DeviceKit version.- Returns:
 - the version identifier
 
 - 
enableLogs
public static void enableLogs(boolean enabled) Enable or disable logs. Logs are stored in the app's folder and written in adb logs. Logs are encrypted. The value resets after eachinit(android.app.Application, java.lang.String) - 
logsEnabled
public static boolean logsEnabled()- Returns:
 - if logs are currently enabled
 
 - 
getBluetoothState
Gets a bluetooth state 
 -