示例#1
0
        private static void SlaveEnableResultEvent(Optoel.Optoel.Ble.BleSlave.EnableResultArgs e)
        {
            switch (e.Sensor)
            {
            case Optoel.Optoel.Sensor.Accel:
                if (e.Enable == Optoel.Optoel.Enable.Enable)
                {
                    Console.WriteLine("Accel Enable");
                }
                else if (e.Enable == Optoel.Optoel.Enable.Disable)
                {
                    Console.WriteLine("Accel Disable");
                }

                bleSlave.GyroEnable(Optoel.Optoel.Enable.Enable);
                break;

            case Optoel.Optoel.Sensor.Gyro:
                if (e.Enable == Optoel.Optoel.Enable.Enable)
                {
                    Console.WriteLine("Gyro Enable");
                }
                else if (e.Enable == Optoel.Optoel.Enable.Disable)
                {
                    Console.WriteLine("Gyro Disable");
                }

                bleSlave.MagnoEnable(Optoel.Optoel.Enable.Enable);
                break;

            case Optoel.Optoel.Sensor.Magno:
                if (e.Enable == Optoel.Optoel.Enable.Enable)
                {
                    Console.WriteLine("Magno Enable");
                }
                else if (e.Enable == Optoel.Optoel.Enable.Disable)
                {
                    Console.WriteLine("Magno Disable");
                }

                bleSlave.AccelSetBw(Optoel.Optoel.AccelBw.AccelBw_62f5);
                break;
            }
        }
示例#2
0
        private static void EnableResultEvent(Optoel.Optoel.Ble.BleSlave sender, Optoel.Optoel.Ble.BleSlave.EnableResultArgs e)
        {
            switch (e.Sensor)
            {
            case Optoel.Optoel.Sensor.Accel:
                if (e.Enable == Optoel.Optoel.Enable.Enable)
                {
                    Console.WriteLine("{0}. Device Accel Enable", sender.SlaveNumber);
                }
                else if (e.Enable == Optoel.Optoel.Enable.Disable)
                {
                    Console.WriteLine("{0}. Device Accel Disable", sender.SlaveNumber);
                }

                sender.GyroEnable(Optoel.Optoel.Enable.Enable);
                break;

            case Optoel.Optoel.Sensor.Gyro:
                if (e.Enable == Optoel.Optoel.Enable.Enable)
                {
                    Console.WriteLine("{0}. Device Gyro Enable", sender.SlaveNumber);
                }
                else if (e.Enable == Optoel.Optoel.Enable.Disable)
                {
                    Console.WriteLine("{0}. Device Gyro Disable", sender.SlaveNumber);
                }

                sender.MagnoEnable(Optoel.Optoel.Enable.Enable);
                break;

            case Optoel.Optoel.Sensor.Magno:
                if (e.Enable == Optoel.Optoel.Enable.Enable)
                {
                    Console.WriteLine("{0}. Device Magno Enable", sender.SlaveNumber);
                }
                else if (e.Enable == Optoel.Optoel.Enable.Disable)
                {
                    Console.WriteLine("{0}. Device Magno Disable", sender.SlaveNumber);
                }

                sender.AccelSetBw(Optoel.Optoel.AccelBw.AccelBw_62f5);
                break;
            }
        }