예제 #1
0
        /// <summary>
        /// Closes the Bluetooth connection by terminating the associated thread, sending a stop command to the IMU device
        /// and closing the underlying Bluetooth connection.
        /// </summary>
        public void close()
        {
            if (bt_manager != null && bt_manager.client != null)
            {
                bt_manager.send_data("M0dg");
                bt_manager.stream_open = false;

                if (bt_manager.get_data != null)
                {
                    /*
                     * while (!bt_manager.safe_to_terminate)
                     * {
                     *  System.Diagnostics.Debug.WriteLine(IMU_number + "--" + "waiting");
                     * }
                     */
                    //bt_manager.get_data.Abort();
                }
                bt_manager.client.Close();
                bt_manager = null;
            }
        }