Example #1
0
        private void buttonDisconnect_Click(object sender, EventArgs e)
        {
            if (ShimmerDevice1 != null)
            {
                if (ShimmerDevice1.GetState() == (int)Shimmer.SHIMMER_STATE_STREAMING)
                {
                    if (ShimmerDevice1.GetFirmwareIdentifier() == 3)
                    {
                    }
                    else
                    {
                        ShimmerDevice1.StopStreaming();
                    }
                }
                ShimmerDevice1.Disconnect();
            }

            if (ShimmerDevice2 != null)
            {
                if (ShimmerDevice2.GetState() == (int)Shimmer.SHIMMER_STATE_STREAMING)
                {
                    if (ShimmerDevice2.GetFirmwareIdentifier() == 3)
                    {
                    }
                    else
                    {
                        ShimmerDevice2.StopStreaming();
                    }
                }
                ShimmerDevice2.Disconnect();
            }

            if (_writeToFileShimmer1 != null)
            {
                _writeToFileShimmer1.CloseFile();
            }

            if (_writeToFileShimmer2 != null)
            {
                _writeToFileShimmer2.CloseFile();
            }
        }
Example #2
0
 /// <summary>
 /// Disconnect device from system.
 /// TODO: figure out why it's crashing on closing connection. Might be part of the "StopStreaming" function
 /// </summary>
 public void Disconnect()
 {
     if (ShimmerDevice != null)
     {
         if (ShimmerDevice.GetState() == (int)Shimmer.SHIMMER_STATE_STREAMING)
         {
             if (ShimmerDevice.GetFirmwareIdentifier() == 3)
             {
             }
             else
             {
                 ShimmerDevice.StopStreaming();
             }
         }
     }
     DeviceConnected = false;
     ShimmerDevice.Disconnect();
     //if (streamingActuallyOccurred())
     {
         //    handleLogging();
     }
 }