Ejemplo n.º 1
0
        //static List<Optoel.Optoel.Ble.BleSlave> ListbleSlave = new List<Optoel.Optoel.Ble.BleSlave>(); //alternatif kullanım
        private static void BleConnectResultevent(Optoel.Optoel.Ble.BleSlave e)
        {
            bleSlave = e;
            //ListbleSlave.Add(e);  // alternatif kullanım

            Console.WriteLine("\nConnected");
            Console.WriteLine("Device Conected State:   " + bleSlave.Connected);
            Console.WriteLine("Device Name:             " + bleSlave.DeviceName);
            Console.WriteLine("Mac Address:             " + bleSlave.MacAddress);
            Console.Write("Mac AddressHex:          ");
            string st = "";

            foreach (var item in bleSlave.MacAddressHEX)
            {
                st += item.ToString("X") + ":";
            }
            st = st.Remove(st.Length - 1);
            Console.WriteLine(st + "\n\n");

            bleSlave.SlaveDisconnected += new Optoel.Optoel.Ble.BleSlave.SlaveDisconnectedEventHandler(SlaveDisconnectedEvent);
            bleSlave.SlaveEnableResult += new Optoel.Optoel.Ble.BleSlave.EnableEventHandler(SlaveEnableResultEvent);
            bleSlave.SlaveBwResult     += new Optoel.Optoel.Ble.BleSlave.BwEventHandler(SlaveBwResultEvent);
            bleSlave.SlaveRangeResult  += new Optoel.Optoel.Ble.BleSlave.RangeEventHandler(SlaveRangeResultEvent);

            bleSlave.AccelData += new Optoel.Optoel.Ble.BleSlave.AccelDataEventHandler(AccelDataEvent);
            bleSlave.GyroData  += new Optoel.Optoel.Ble.BleSlave.GyroDataEventHandler(GyroDataEvent);
            bleSlave.MagnoData += new Optoel.Optoel.Ble.BleSlave.MagnoDataEventHandler(MagnoDataEvent);


            bleSlave.AccelEnable(Optoel.Optoel.Enable.Enable);
        }
Ejemplo n.º 2
0
        private static void BleConnectResultevent(Optoel.Optoel.Ble.BleSlave e)
        {
            //bleSlave = e;  /* alternatif kullanım */
            e.SlaveNumber = slaveNmbr; // Kullanıcı tarafından isteğe göre verilen cihaz numarası.
            slaveNmbr++;
            ListbleSlave.Add(e);

            Console.WriteLine("\nConnected");
            Console.WriteLine("Device Conected State:   " + e.Connected);
            Console.WriteLine("Device Name:             " + e.DeviceName);
            Console.WriteLine("Mac Address:             " + e.MacAddress);
            Console.Write("Mac AddressHex:          ");
            string st = "";

            foreach (var item in e.MacAddressHEX)
            {
                st += item.ToString("X") + ":";
            }
            st = st.Remove(st.Length - 1);
            Console.WriteLine(st + "\n\n");

            e.AccelEnable(Optoel.Optoel.Enable.Enable);
        }