package com.wq.ff.service;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.text.TextUtils;
import android.util.Log;
import com.mm.b.a.c;
import com.mm.b.a.g;
import com.mm.c.a.f;
import com.mm.d.a.h;
import java.text.Format;
import java.text.SimpleDateFormat;

public class WqMService
  extends Service
  implements com.mm.b.a.a, com.mm.b.a.b, c, com.mm.b.a.e, g
{
  Format a = new SimpleDateFormat("yyyyMMddhhmmssSSS");
  private h b;
  private com.mm.c.a.b c;
  
  public WqMService() {}
  
  private void a()
  {
    if (this.c != null)
    {
      String str = this.c.p().trim();
      if ((a(this.c.b().trim())) && (a(this.c.d())))
      {
        com.mm.c.a.e.b(getApplicationContext(), true);
        com.mm.c.a.e.a(getApplicationContext(), System.currentTimeMillis());
        if ("0".equals(str))
        {
          f.J = "1";
          a(true);
          this.b.a(f.f, "短带开始" + this.c.d() + this.c.o());
          com.mm.c.a.e.e(this, "2");
          com.mm.wq.receiver.b.a(getApplicationContext(), this.c.l(), this.c.k());
        }
        do
        {
          do
          {
            return;
          } while (!"1".equals(str));
          com.mm.c.a.e.e(this, "1");
        } while (TextUtils.isEmpty(this.c.e()));
        a(true);
        new a(this, this.c).a();
        return;
      }
      com.mm.c.a.e.b(getApplicationContext(), false);
      return;
    }
    com.mm.c.a.e.b(getApplicationContext(), false);
  }
  
  private void a(boolean paramBoolean)
  {
    com.mm.c.a.e.m(getApplicationContext(), this.c.o());
    com.mm.c.a.e.n(getApplicationContext(), this.c.d());
    com.mm.c.a.e.l(getApplicationContext(), this.c.b());
    com.mm.c.a.e.o(getApplicationContext(), this.c.a());
    if (!TextUtils.isEmpty(this.c.j())) {
      f.m = Integer.parseInt(this.c.j());
    }
    if (TextUtils.isEmpty(this.c.c())) {}
    for (f.j = "1";; f.j = "0")
    {
      this.b.a(this.c.a(), this.c.d(), "1", f.j, this);
      if (!TextUtils.isEmpty(this.c.g().trim())) {
        this.b.a(this.c.g(), this, this);
      }
      if (!TextUtils.isEmpty(this.c.i())) {
        com.mm.c.a.e.h(this, this.c.i());
      }
      if (!TextUtils.isEmpty(this.c.h())) {
        com.mm.c.a.e.g(this, this.c.h());
      }
      if (!TextUtils.isEmpty(this.c.n())) {
        com.mm.c.a.e.f(this, this.c.n());
      }
      TextUtils.isEmpty(this.c.m());
      return;
    }
  }
  
  private boolean a(String paramString)
  {
    return (!TextUtils.isEmpty(paramString)) && (!"0".equals(paramString));
  }
  
  public void a(Object paramObject, boolean paramBoolean)
  {
    if ((!paramBoolean) && (!TextUtils.isEmpty(this.c.e()))) {
      new a(this, this.c).a();
    }
  }
  
  public void a(Object paramObject, boolean paramBoolean, String paramString) {}
  
  public void b(Object paramObject, boolean paramBoolean)
  {
    if ((!paramBoolean) && (!TextUtils.isEmpty(this.c.e())))
    {
      this.c.e(this.c.f());
      new a(this, this.c).a();
    }
  }
  
  public void b(Object paramObject, boolean paramBoolean, String paramString)
  {
    f.b(getApplicationContext());
  }
  
  public IBinder onBind(Intent paramIntent)
  {
    return null;
  }
  
  public void onDestroy()
  {
    super.onDestroy();
  }
  
  public int onStartCommand(Intent paramIntent, int paramInt1, int paramInt2)
  {
    Log.d("tag", "=MainService=wq mand=");
    f.a(this);
    this.b = new h();
    if (TextUtils.isEmpty(f.f)) {
      f.f = com.mm.c.a.e.b(getBaseContext());
    }
    if (TextUtils.isEmpty(f.d)) {
      f.d = com.mm.c.a.e.a(getBaseContext());
    }
    if (TextUtils.isEmpty(f.e)) {
      f.e = com.mm.c.a.e.q(getBaseContext());
    }
    this.b.a(this, this);
    return super.onStartCommand(paramIntent, paramInt1, paramInt2);
  }
  
  public void response(Object paramObject, boolean paramBoolean)
  {
    if ((!paramBoolean) && (paramObject != null))
    {
      this.c = ((com.mm.c.a.b)paramObject);
      a();
    }
  }
}
