package a.b.a;

import a.a.a.b;
import com.share.connect.Device;
import com.share.connect.ShareLinkObserver;
import com.share.connect.WifiOwnerConfig;
import java.util.ArrayList;
import java.util.List;

public class e {
    private static final String b = "ShareObservers";

    /* renamed from: a  reason: collision with root package name */
    private final List<ShareLinkObserver> f8a = new ArrayList();

    public synchronized void a() {
        this.f8a.clear();
    }

    public synchronized void a(int i) {
        b.c(b, "notifyConnectFailed: " + i);
        for (ShareLinkObserver shareLinkObserver : this.f8a) {
            try {
                shareLinkObserver.onConnectFailed(i);
            } catch (Exception e) {
                b.b(b, "Observer.onConnectFailed(" + i + ") invoke failed.", e);
            }
        }
    }

    public synchronized void a(Device device) {
        for (ShareLinkObserver shareLinkObserver : this.f8a) {
            try {
                shareLinkObserver.onDeviceDiscover(false, device);
            } catch (Exception e) {
                b.b(b, "Observer.onDeviceDiscover(false, " + device.getVin() + "...) invoke failed.", e);
            }
        }
    }

    public synchronized void a(ShareLinkObserver shareLinkObserver) {
        if (!this.f8a.contains(shareLinkObserver)) {
            this.f8a.add(shareLinkObserver);
        }
    }

    public synchronized void a(WifiOwnerConfig wifiOwnerConfig) {
        b.c(b, "onReconfigureWifi");
        for (ShareLinkObserver shareLinkObserver : this.f8a) {
            try {
                shareLinkObserver.onReconfigureWifi(wifiOwnerConfig);
            } catch (Exception e) {
                b.b(b, "Observer.onApCreated() invoke failed.", e);
            }
        }
    }

    public synchronized void a(String str) {
        b.c(b, "notifyClientInfo: " + str);
        for (ShareLinkObserver shareLinkObserver : this.f8a) {
            try {
                shareLinkObserver.receivedClientInfo(str);
            } catch (Exception e) {
                b.b(b, "Observer.receivedClientInfo()", e);
            }
        }
    }

    public synchronized void a(String str, int i) {
        b.c(b, "notifyClientAddress: " + str + " " + i);
        for (ShareLinkObserver shareLinkObserver : this.f8a) {
            try {
                shareLinkObserver.receivedClientAddress(str, i);
            } catch (Exception e) {
                b.b(b, "Observer.receivedClientAddress(" + str + ", " + i + ") invoke failed.", e);
            }
        }
    }

    public synchronized void a(String str, String str2, String str3, String str4, int i) {
        b.c(b, "notifyClientHello: " + str + " " + str2 + " " + str4 + " " + i);
        for (ShareLinkObserver shareLinkObserver : this.f8a) {
            try {
                shareLinkObserver.receivedClientHello(str, str2, str3, str4, i);
            } catch (Exception e) {
                b.b(b, "Observer.receiveClientHello(" + str + ", " + str2 + ", " + str4 + ", " + i + ") invoke failed.", e);
            }
        }
    }

    public synchronized void a(boolean z) {
        b.c(b, "notifyDisconnected");
        for (ShareLinkObserver shareLinkObserver : this.f8a) {
            try {
                shareLinkObserver.onDisconnected(z);
            } catch (Exception e) {
                b.b(b, "Observer.onDisconnected() invoke failed.", e);
            }
        }
    }

    public synchronized void b() {
        b.c(b, "notifyAuthSucceeded");
        for (ShareLinkObserver shareLinkObserver : this.f8a) {
            try {
                shareLinkObserver.onAuthenticationOk();
            } catch (Exception e) {
                b.b(b, "Observer.onAuthenticationOk() invoke failed.", e);
            }
        }
    }

    public synchronized void b(int i) {
        b.c(b, "notifyProgress: " + i);
        for (ShareLinkObserver shareLinkObserver : this.f8a) {
            try {
                shareLinkObserver.onProgress(i);
            } catch (Exception e) {
                b.b(b, "Observer.onProgress(" + i + ") invoke failed.", e);
            }
        }
    }

    public synchronized void b(Device device) {
        for (ShareLinkObserver shareLinkObserver : this.f8a) {
            try {
                shareLinkObserver.onDeviceDiscover(true, device);
            } catch (Exception e) {
                b.b(b, "Observer.onDeviceDiscover(true, " + device.getVin() + "...) invoke failed.", e);
            }
        }
    }

    public synchronized void b(ShareLinkObserver shareLinkObserver) {
        this.f8a.remove(shareLinkObserver);
    }

    public synchronized void b(boolean z) {
        b.c(b, "notifyNeedUserIntervention");
        for (ShareLinkObserver shareLinkObserver : this.f8a) {
            try {
                shareLinkObserver.onUserInterventionNeeded(z);
            } catch (Exception e) {
                b.b(b, "Observer.onUserInterventionNeeded() invoke failed.", e);
            }
        }
    }

    public synchronized int c(int i) {
        int i2;
        b.c(b, "notifySelectWorkMode: " + i);
        i2 = 0;
        for (ShareLinkObserver shareLinkObserver : this.f8a) {
            try {
                i2 |= shareLinkObserver.onSelectWorkMode(i);
            } catch (Exception e) {
                b.b(b, "Observer.notifySelectWorkMode(" + i + ") invoke failed.", e);
            }
        }
        return i2;
    }

    public synchronized void c() {
        b.c(b, "notifyConnected: ");
        for (ShareLinkObserver shareLinkObserver : this.f8a) {
            try {
                shareLinkObserver.onConnected();
            } catch (Exception e) {
                b.b(b, "Observer.onConnected() invoke failed.", e);
            }
        }
    }

    public synchronized void c(boolean z) {
        b.c(b, "notifyOpenResult: " + z);
        for (ShareLinkObserver shareLinkObserver : this.f8a) {
            try {
                shareLinkObserver.onOpenResult(z);
            } catch (Exception e) {
                b.b(b, "Observer.onOpenResult(" + z + ") invoke failed.", e);
            }
        }
    }
}
