protected void UpdateConnect()
 {
     if (connect != _connect)
     {
         if (connect)
         {
             if (native == null)
             {
                 Log("Peripheral not available, cannot connect");
                 connect = false;
             }
             else
             {
                 Debug.Assert(conn == null);
                 Log("Connecting...");
                 conn = native.Connect();
             }
         }
         else
         {
             if (conn != null)
             {
                 conn.Disconnect();
                 conn = null;
             }
         }
         _connect = connect;
     }
 }
示例#2
0
    public BLEConnection Connect()
    {
        BLEConnection conn = BLENativeConnect(manager, this);

        conn.manager = manager;
        return(conn);
    }
示例#3
0
 public BLEVibrationDeviceMultipleThreads(BLEConnection bleConnection)
 {
     this.numberOfMotors = NUMBER_OF_MOTORS;
     motorThreads        = new MotorThread[numberOfMotors];
     motorLocks          = new object[numberOfMotors];
     motors = new BLEMotor[numberOfMotors];
     for (int i = 0; i < motors.Length; i++)
     {
         motors[i] = new BLEMotor(bleConnection, 4 + i);
     }
 }
示例#4
0
 public void SetBLEConnection(BLEConnection connection)
 {
     bleCommunication = connection;
 }