Beispiel #1
0
 /// <summary>
 /// bt_OpenPort_Click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void bt_OpenPort_Click(object sender, EventArgs e)
 {
     if (this.isOpenPort == false)
     {
         string     portName = cb_PortList.SelectedItem.ToString();
         MEMEStatus result   = memeLib.ConnectComPort(portName);
         if (result == MEMEStatus.MEMELIB_OK)
         {
             this.SetTextColor(0x01, "Scan Port", Color.Black, Color.LightGray);
             this.SetTextColor(0x02, "Close", Color.White, Color.Red);
             this.SetTextColor(0x03, "Scan MEME", Color.White, Color.Red);
             this.isOpenPort = true;
         }
         else
         {
             this.SetTextColor(0x01, "Scan Port", Color.White, Color.Red);
             this.SetTextColor(0x02, "Open", Color.White, Color.Red);
             this.SetTextColor(0x03, "Scan MEME", Color.Black, Color.LightGray);
             this.isOpenPort = false;
         }
     }
     else
     {
         this.memeLib.DisconnectComPort();
         this.isOpenPort = false;
         this.SetTextColor(0x01, "Scan Port", Color.White, Color.Red);
         this.SetTextColor(0x02, "Open", Color.Black, Color.LightGray);
         this.SetTextColor(0x03, "Scan MEME", Color.Black, Color.LightGray);
         this.SetTextColor(0x04, "Connect", Color.Black, Color.LightGray);
     }
 }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="result"></param>
        private void memePeripheralConnected(object sender, MEMEStatus result)
        {
            if (result == MEMEStatus.MEMELIB_OK)
            {
                this.isConnectedPeripheral = true;
                this.SetConnectionStatus("Status : Connected");
                this.SetTextColor(0x04, "Disconnect", Color.White, Color.Red);
                this.SetTextColor(0x05, "Start Measurement", Color.White, Color.Red);

                this.fwVersion = this.memeLib.getFWVersion();
                this.deviceVersionLabel.Text = this.fwVersion;
                this.sdkVersion           = this.memeLib.getSDKVersion();
                this.SDKVersionLabel.Text = this.sdkVersion;
                this.hwVersion            = this.memeLib.getHWVersion();

                this.mode       = this.memeLib.getMode();
                this.quality    = this.memeLib.getQuality();
                this.accelRange = this.memeLib.getAccelRange();
                this.gyroRange  = this.memeLib.getGyroRange();
            }
            else if (result == MEMEStatus.MEMELIB_TIMEOUT)
            {
                this.isConnectedPeripheral = false;
                this.SetConnectionStatus("Status : Disonnected");
                this.SetTextColor(0x04, "Connect", Color.White, Color.Red);
                this.SetTextColor(0x05, "Start Measurement", Color.Black, Color.LightGray);
            }
        }
Beispiel #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="result"></param>
 /// <param name="deviceAddress"></param>
 private void memePeripheralFound(object sender, MEMEStatus result, string deviceAddress)
 {
     if (result == MEMEStatus.MEMELIB_OK)
     {
         this.SetDeviceAddress(deviceAddress);
     }
     else if (result == MEMEStatus.MEMELIB_TIMEOUT)
     {
         if (this.cb_DeviceList.Items.Count > 0)
         {
             this.SetTextColor(0x04, "Connect", Color.White, Color.Red);
         }
     }
 }
Beispiel #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="result"></param>
 private void memePeripheralDisconnected(object sender, MEMEStatus result)
 {
     if (result == MEMEStatus.MEMELIB_OK)
     {
         this.isConnectedPeripheral = false;
         this.SetConnectionStatus("Status : Disonnected");
         this.SetTextColor(0x04, "Connect", Color.White, Color.Red);
         this.SetTextColor(0x05, "Start Measurement", Color.Black, Color.LightGray);
     }
     else if (result == MEMEStatus.MEMELIB_TIMEOUT)
     {
         this.isConnectedPeripheral = false;
         this.SetConnectionStatus("Status : Disonnected");
         this.SetTextColor(0x04, "Connect", Color.White, Color.Red);
         this.SetTextColor(0x05, "Start Measurement", Color.Black, Color.LightGray);
     }
 }
Beispiel #5
0
            public override void MemeAppAuthorized(MEMEStatus status)
            {
                // ToDo: Error handling
                switch (status)
                {
                case MEMEStatus.ErrorAppAuth:
                    System.Diagnostics.Debug.WriteLine("Auth: ErrorAppAuth, Invalid Application ID or Client Secret");
                    break;

                case MEMEStatus.ErrorSdkAuth:
                    System.Diagnostics.Debug.WriteLine("Auth: ErrorSdkAuth, Invalid SDK. Please update to the latest SDK.");
                    break;

                case MEMEStatus.Ok:
                    System.Diagnostics.Debug.WriteLine("Auth: Ok");
                    break;

                default:
                    break;
                }
            }