package com.worklight.location.internal.deviceContextPiggybacker;

import com.worklight.location.api.geo.WLGeoPosition;
import com.worklight.location.api.wifi.WLWifiLocation;
import com.worklight.location.internal.DeviceContextImpl;

final class LastModifiedSensorEncoder
  implements SensorEncoder<Long>
{
  private final DeviceContextImpl deviceContext;
  private final DeviceContextPiggybacker deviceContextPiggybacker;

  LastModifiedSensorEncoder(DeviceContextPiggybacker paramDeviceContextPiggybacker, DeviceContextImpl paramDeviceContextImpl)
  {
    this.deviceContextPiggybacker = paramDeviceContextPiggybacker;
    this.deviceContext = paramDeviceContextImpl;
  }

  public void encode(Long paramLong)
  {
    long l = -1L;
    if ((this.deviceContext.getGeoPosition() != null) && (this.deviceContext.getGeoPosition().getTimestamp() != null))
      l = this.deviceContext.getGeoPosition().getTimestamp().longValue();
    if ((this.deviceContext.getWifiLocation() != null) && (this.deviceContext.getWifiLocation().getTimestamp() != null))
      l = Math.max(l, this.deviceContext.getWifiLocation().getTimestamp().longValue());
    if (paramLong.longValue() == l)
    {
      this.deviceContextPiggybacker.sensorInfo.append(this.deviceContextPiggybacker.writeNumber(1L, 1));
      return;
    }
    this.deviceContextPiggybacker.sensorInfo.append(this.deviceContextPiggybacker.writeNumber(0L, 1));
    this.deviceContextPiggybacker.sensorInfo.append(this.deviceContextPiggybacker.encodeNonNegativeNumber(paramLong.longValue()));
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.worklight.location.internal.deviceContextPiggybacker.LastModifiedSensorEncoder
 * JD-Core Version:    0.6.2
 */