Ejemplo n.º 1
0
 public void Stop()
 {
     if (Central != null)
     {
         Central.PeripheralsChanged -= Central_PeripheralsChanged;
         Central = null;
     }
     if (rPeripheral != null)
     {
         rPeripheral.StreamReceived -= Peripheral_StreamReceived;
         if (rPeripheral.Status != PeripheralStatus.Disconnected)
         {
             rPeripheral.Stop();
         }
         rPeripheral = null;
     }
     if (lPeripheral != null)
     {
         lPeripheral.StreamReceived -= Peripheral_StreamReceived;
         if (lPeripheral.Status != PeripheralStatus.Disconnected)
         {
             lPeripheral.Stop();
         }
         lPeripheral = null;
     }
 }
Ejemplo n.º 2
0
        // Use this for initialization
        void Start()
        {
            lFingers = new Finger[5];
            rFingers = new Finger[5];

            lFingers[4] = new Finger(250, 3000, "Thumb");
            lFingers[3] = new Finger(150, 1000, "Index");
            lFingers[2] = new Finger(150, 1000, "Mid");
            lFingers[1] = new Finger(200, 1000, "Ring");
            lFingers[0] = new Finger(250, 1000, "Pinky");

            rFingers[0] = new Finger(500, 2800, "Thumb");
            rFingers[1] = new Finger(250, 1000, "Index");
            rFingers[2] = new Finger(150, 1000, "Mid");
            rFingers[3] = new Finger(100, 1000, "Ring");
            rFingers[4] = new Finger(100, 1000, "Pinky");

            if (!isLocalPlayer)
            {
                return;
            }

            Debug.Log("Start ");
            var logEntry = new CallbackLogEntry(LogLevel.Debug);

            logEntry.LogReceived += (obj, arguments) =>
            {
                Debug.Log(arguments.Message);
            };
            GSdkNet.Bridge.Logger.Shared.AddEntry(logEntry);
            Debug.Log("Looking for peripheral");
            var boardFactory = new BoardFactory();

            Central = boardFactory.MakeBoardCentral();
            Central.PeripheralsChanged += Central_PeripheralsChanged;
            Central.StartScan(new ScanOptions()
            {
                PreferredInterval = 5
            });
        }