package a.c.d;

import java.util.Timer;
import java.util.TimerTask;

public class b {
    private static final String f = "TimerManager";
    private static final long g = 10000;
    private static final long h = 7000;

    /* renamed from: a  reason: collision with root package name */
    private c f93a;
    private TimerTask b;
    private Timer c;
    private TimerTask d;
    private Timer e;

    public class a extends TimerTask {
        public a() {
        }

        public void run() {
            a.a.a.b.a(b.f, "connect time out");
            if (b.this.f93a != null) {
                b.this.f93a.b();
            }
        }
    }

    /* renamed from: a.c.d.b$b  reason: collision with other inner class name */
    public class C0008b extends TimerTask {
        public C0008b() {
        }

        public void run() {
            a.a.a.b.a(b.f, "heart beat time out");
            if (b.this.f93a != null) {
                b.this.f93a.a();
            }
        }
    }

    public interface c {
        void a();

        void b();
    }

    private void d() {
        this.b = new a();
        this.c = new Timer();
    }

    private void e() {
        this.d = new C0008b();
        this.e = new Timer();
    }

    public void a() {
    }

    public void a(c cVar) {
        this.f93a = cVar;
    }

    public void b() {
        if (this.c != null) {
            a.a.a.b.a(f, "cancel connect timer");
            this.c.cancel();
            this.b = null;
            this.c = null;
        }
    }

    public void c() {
        if (this.e != null) {
            a.a.a.b.a(f, "cancel heart beat timer");
            this.e.cancel();
            this.d = null;
            this.e = null;
        }
    }

    public void f() {
        d();
        if (this.c != null) {
            a.a.a.b.a(f, "schedule connect timer");
            this.c.schedule(this.b, g);
        }
    }

    public void g() {
        e();
        if (this.e != null) {
            a.a.a.b.a(f, "schedule heart beat timer");
            this.e.schedule(this.d, h);
        }
    }

    public void h() {
        this.f93a = null;
    }
}
