Exemplo n.º 1
0
        /// <summary>
        /// Restarts adb, but not the services around it.
        /// </summary>
        /// <returns><c>true</c> if success.</returns>
        public bool Restart( )
        {
            if (string.IsNullOrEmpty(AdbOsLocation))
            {
                Log.e(ADB, "Cannot restart adb when AndroidDebugBridge is created without the location of adb.");
                return(false);
            }

            if (!VersionCheck)
            {
                Log.LogAndDisplay(LogLevel.Error, ADB, "Attempting to restart adb, but version check failed!");
                return(false);
            }
            lock (this) {
                StopAdb( );

                bool restart = StartAdb( );

                if (restart && DeviceMonitor == null)
                {
                    DeviceMonitor = new DeviceMonitor(this);
                    DeviceMonitor.Start( );
                }

                return(restart);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Starts the debug bridge.
        /// </summary>
        /// <returns><c>true</c> if success.</returns>
        public bool Start( )
        {
            if (String.IsNullOrEmpty(AdbOsLocation) || !VersionCheck || !StartAdb( ))
            {
                return(false);
            }

            Started = true;

            // now that the bridge is connected, we start the underlying services.
            DeviceMonitor = new DeviceMonitor(this);
            DeviceMonitor.Start( );

            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Kills the debug bridge, and the adb host server.
        /// </summary>
        /// <returns><c>true</c> if success.</returns>
        public bool Stop( )
        {
            // if we haven't started we return false;
            if (!Started)
            {
                return(false);
            }

            // kill the monitoring services
            if (DeviceMonitor != null)
            {
                DeviceMonitor.Stop( );
                DeviceMonitor = null;
            }

            if (!StopAdb( ))
            {
                return(false);
            }

            Started = false;
            return(true);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Starts the debug bridge.
        /// </summary>
        /// <returns><c>true</c> if success.</returns>
        public bool Start( )
        {
            if ( String.IsNullOrEmpty(AdbOsLocation) || !VersionCheck || !StartAdb ( ) ) {
                return false;
            }

            Started = true;

            // now that the bridge is connected, we start the underlying services.
            DeviceMonitor = new DeviceMonitor ( this );
            DeviceMonitor.Start ( );

            return true;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Restarts adb, but not the services around it.
        /// </summary>
        /// <returns><c>true</c> if success.</returns>
        public bool Restart( )
        {
            if ( string.IsNullOrEmpty ( AdbOsLocation ) ) {
                Log.e ( ADB, "Cannot restart adb when AndroidDebugBridge is created without the location of adb." );
                return false;
            }

            if ( !VersionCheck ) {
                Log.LogAndDisplay ( LogLevel.Error, ADB, "Attempting to restart adb, but version check failed!" );
                return false;
            }
            lock ( this ) {
                StopAdb ( );

                bool restart = StartAdb ( );

                if ( restart && DeviceMonitor == null ) {
                    DeviceMonitor = new DeviceMonitor ( this );
                    DeviceMonitor.Start ( );
                }

                return restart;
            }
        }