package com.seewo.factoryaging.co2;

import android.annotation.SuppressLint;
import android.content.Context;
import j.i;
import j.k;
import j.k0.o;
import j.p0.d.r;
import j.p0.d.s;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import jxl.write.WriteException;

/* JADX INFO: compiled from: Co2Presenter.kt */
/* JADX INFO: loaded from: classes.dex */
public final class e extends c {
    private final Context c;
    private final i d;

    /* JADX INFO: compiled from: Co2Presenter.kt */
    static final class a extends s implements j.p0.c.a<h> {
        a() {
            super(0);
        }

        @Override // j.p0.c.a
        /* JADX INFO: renamed from: a, reason: merged with bridge method [inline-methods] */
        public final h invoke() {
            return new h(e.this.c);
        }
    }

    public e(Context context) {
        r.f(context, "context");
        this.c = context;
        this.d = k.b(new a());
    }

    private final h n() {
        return (h) this.d.getValue();
    }

    private final void q(long j2, int i2, int i3) throws WriteException, IOException {
        if (j2 % TimeUnit.MINUTES.toSeconds(15L) == 0) {
            n().a(new f(i2, i3));
            n().g();
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final List r(e eVar, Long l2) throws WriteException, IOException {
        r.f(eVar, "this$0");
        r.f(l2, "it");
        int iB = h.c.c.f.a.b();
        int iC = h.c.c.f.a.c();
        eVar.q(l2.longValue(), iB, iC);
        return o.i(Integer.valueOf(iB), Integer.valueOf(iC));
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void s(e eVar, List list) {
        r.f(eVar, "this$0");
        d dVarI = eVar.i();
        if (dVarI != null) {
            dVarI.B(((Number) list.get(0)).intValue());
        }
        d dVarI2 = eVar.i();
        if (dVarI2 != null) {
            dVarI2.u(((Number) list.get(1)).intValue());
        }
    }

    @Override // com.seewo.factoryaging.co2.c
    @SuppressLint({"CheckResult"})
    public void l() {
        i.a.d.r(1L, TimeUnit.SECONDS).c(c()).u(i.a.q.a.b()).t(new i.a.m.d() { // from class: com.seewo.factoryaging.co2.b
            @Override // i.a.m.d
            public final Object a(Object obj) {
                return e.r(this.a, (Long) obj);
            }
        }).u(i.a.j.b.a.a()).x(new i.a.m.c() { // from class: com.seewo.factoryaging.co2.a
            @Override // i.a.m.c
            public final void accept(Object obj) {
                e.s(this.a, (List) obj);
            }
        });
    }
}
