protected override void OnPause()
 {
     base.OnPause();
     deinitSerialComm();
     serialCommManager = null;
     if (emdkManager != null)
     {
         // Clean up the objects created by EMDK manager
         emdkManager.Release(EMDKManager.FEATURE_TYPE.SerialcommEx);
         emdkManager = null;
     }
 }
        protected override void OnResume()
        {
            base.OnResume();
            // Acquire the serialComm manager resources
            if (emdkManager != null)
            {
                serialCommManager = (SerialCommMgrEX)emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.SerialcommEx);

                if (serialCommManager != null)
                {
                    populatePorts();
                    initSerialComm();
                }
            }
        }
        public void OnOpened(EMDKManager emdkManager)
        {
            this.emdkManager = emdkManager;

            Log.Debug(TAG, "EMDK opened");

            try
            {
                serialCommManager = (SerialCommMgrEX)this.emdkManager.GetInstance(EMDKManager.FEATURE_TYPE.SerialcommEx);
                if (serialCommManager != null)
                {
                    populatePorts();
                }
                else
                {
                    RunOnUiThread(() => statusView.Text = EMDKManager.FEATURE_TYPE.SerialcommEx.ToString() + " Feature not supported.");
                }
            }
            catch (SerialCommException e)
            {
                Log.Debug(TAG, e.Message);
                RunOnUiThread(() => statusView.Text = e.Message);
            }
        }