package com.kofax.kmc.klo.logistics.webservice.calls; import android.os.Build; import com.kofax.kmc.klo.logistics.service.CryptoService; import com.kofax.kmc.klo.logistics.service.NetworkService; import com.kofax.kmc.klo.logistics.webservice.DeviceServiceResponse; import com.kofax.kmc.klo.logistics.webservice.KofaxWebServiceResponseBase; import com.kofax.kmc.klo.logistics.webservice.WebServiceCallResult; import com.kofax.kmc.kut.utilities.CertificateValidatorListener; import com.kofax.kmc.kut.utilities.error.ErrorInfo; import com.kofax.mobile.sdk._internal.k; import java.net.ConnectException; import java.net.SocketTimeoutException; import java.net.URL; import javax.net.ssl.SSLException; import o.gjJ; import o.gmO; /* loaded from: classes3.dex */ public class DeviceService extends KofaxWebServiceCallBase { public static int ERROR_LICENSE_REQUIRES_AUTH = 12; public static int ERROR_LICENSING = 5; public static String METHOD_NAME = "updateDeviceInfo"; public static String NAMESPACE = "http://device.wsc.des.kofax.com"; public static String SERVICE_NAME = "DeviceService"; public static String SOAP_ACTION = "urn:updateDeviceInfo"; private static final String TAG = "DeviceService"; @Override // com.kofax.kmc.klo.logistics.webservice.calls.KofaxWebServiceCallBase public WebServiceCallResult init(URL url, CertificateValidatorListener certificateValidatorListener) { WebServiceCallResult init = super.init(url, certificateValidatorListener); init.isSuccess(); return init; } @Override // com.kofax.kmc.klo.logistics.webservice.calls.KofaxWebServiceCallBase public KofaxWebServiceResponseBase populateFromResponse(gmO gmo) { return DeviceServiceResponse.populateFromResponse(gmo); } @Override // com.kofax.kmc.klo.logistics.webservice.calls.KofaxWebServiceCallBase public gmO packageRequest() { String obj; String macAddress = NetworkService.getMacAddress(); String ipAddress = NetworkService.getIpAddress(); StringBuilder sb = new StringBuilder(); sb.append(Character.toUpperCase(Build.MANUFACTURER.charAt(0))); sb.append(Build.MANUFACTURER.substring(1)); String obj2 = sb.toString(); if (gjJ.d((CharSequence) Build.MODEL, (CharSequence) obj2)) { obj = Build.MODEL; } else { StringBuilder sb2 = new StringBuilder(); sb2.append(obj2); sb2.append(" "); sb2.append(Build.MODEL); obj = sb2.toString(); } StringBuilder sb3 = new StringBuilder(); sb3.append(macAddress); sb3.append(macAddress); sb3.append(ipAddress); sb3.append(macAddress); sb3.append(macAddress); String obj3 = sb3.toString(); String str = TAG; k.b(str, "hostName -> ".concat(String.valueOf(macAddress))); k.b(str, "deviceName -> ".concat(String.valueOf(macAddress))); k.b(str, "macAddress -> ".concat(String.valueOf(macAddress))); k.b(str, "ipAddress -> ".concat(String.valueOf(ipAddress))); k.b(str, "reserved (pre-SHA) -> ".concat(String.valueOf(obj3))); String concat = "1:1:".concat(String.valueOf(CryptoService.sha1Hash(obj3))); k.b(str, "reserved (complete) -> ".concat(String.valueOf(concat))); gmO gmo = new gmO(getNamespace(), getMethodName()); gmo.d("wscClientID", macAddress); gmo.d("macAddress", macAddress); gmo.d("ipAddress", ipAddress); gmo.d("hostname", macAddress); gmo.d("vendor", obj2); gmo.d("model", obj); gmo.d("devicename", macAddress); gmo.d("reserved", concat); return gmo; } public static WebServiceCallResult updateDeviceInfo(URL url, CertificateValidatorListener certificateValidatorListener, int i) { new WebServiceCallResult().setSuccess(false); DeviceService deviceService = new DeviceService(); deviceService.setTimeout(i); WebServiceCallResult init = deviceService.init(url, certificateValidatorListener); if (init.isSuccess()) { init.setSuccess(false); try { DeviceServiceResponse deviceServiceResponse = (DeviceServiceResponse) deviceService.execute(); if (deviceServiceResponse.getResultCode() == 0) { init.setSuccess(true); init.setExtraData(deviceServiceResponse); } else { init.setErrorMsg(deviceServiceResponse.getErrorMessage()); init.setExtraData(deviceServiceResponse); init.setSuccess(false); } } catch (ConnectException e) { k.e(TAG, "Error in updateDeviceInfo", (Throwable) e); if (e.getMessage().indexOf("Network is unreachable") >= 0) { init.setErrorMsg("Network Unavailable. Please check your network settings and try again."); } init.setErrorMsg("Network is unreachable, Please check your network settings and try again."); } catch (SocketTimeoutException e2) { k.e(TAG, "Device Service SocketTimeoutException", (Throwable) e2); init.setErrorMsg(e2.getMessage()); init.setErrorInfo(ErrorInfo.KMC_LO_REQUEST_TIMEOUT); } catch (SSLException e3) { k.e(TAG, "Error in updateDeviceInfo", (Throwable) e3); init.setErrorMsg(e3.getMessage()); init.setCertificateError(true); } catch (Exception e4) { k.e(TAG, "Error in updateDeviceInfo", (Throwable) e4); init.setErrorMsg("Network is unreachable, Please check your network settings and try again."); } } return init; } @Override // com.kofax.kmc.klo.logistics.webservice.calls.KofaxWebServiceCallBase public String getSoapAction() { return SOAP_ACTION; } @Override // com.kofax.kmc.klo.logistics.webservice.calls.KofaxWebServiceCallBase public String getServiceName() { return SERVICE_NAME; } @Override // com.kofax.kmc.klo.logistics.webservice.calls.KofaxWebServiceCallBase public String getNamespace() { return NAMESPACE; } @Override // com.kofax.kmc.klo.logistics.webservice.calls.KofaxWebServiceCallBase public String getMethodName() { return METHOD_NAME; } }