NVRDeviceInfoActivity.java 源代码
package main.NVR.Setting;
import activity.setting.ChooseDNSTypeActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import base.HiActivity;
import bean.MyCamera;
import com.hichip.NVR.content.HiChipNVRDefines;
import com.hichip.base.HiLog;
import com.hichip.callback.ICameraIOSessionCallback;
import com.hichip.campro.R;
import com.hichip.content.HiChipDefines;
import com.hichip.control.HiCamera;
import com.hichip.tools.Packet;
import com.meizu.cloud.pushsdk.constants.PushConstants;
import com.xiaomi.mipush.sdk.Constants;
import common.CamHiDefines;
import common.Constant;
import common.ConstantCommand;
import common.HiDataValue;
import common.TitleView;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import liteos.ossetting.LiteOsSettingActivity;
import main.MainActivity;
import main.NVR.Setting.NVRDeviceInfoActivity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.apache.xmlbeans.XmlErrorCodes;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import utils.DialogUtilsCamHiPro;
import utils.HiLogcatUtil;
import utils.MyToast;
public class NVRDeviceInfoActivity extends HiActivity implements ICameraIOSessionCallback {
private static final int CHOOSE_DNS_TYPE = 10010;
private static final int GET_UPDATE_VERSION_DATA = 65536;
private static final int GET_UPDATE_VERSION_NUM = 39321;
private static final int HI_P2P_GET_CONFIGCAPIFO_KEYNAME_PARAM = 16792;
private static String LiteOsDownloadUrl = "http://upgrade.hichip.net/goke_update.html";
private static final int UPDATA_STATE_CHECKING = 1;
private static final int UPDATA_STATE_NONE = 0;
private HiChipDefines.HI_P2P_GET_DEV_INFO_EXT deviceInfo;
private TextView device_name_tv;
private ConstantCommand.HI_P2P_S_DEV_DNS_PARAM dns_param;
private TextView dns_tv;
private TextView dns_tv1;
private TextView dns_tv2;
private TextView dns_type;
private TextView gateway_tv;
private TextView gunware_version_tv;
private ConstantCommand.HI_P2P_GET_UNITE_IPC_IMAGETYPE_PARAM imagetype_param;
private TextView ip_address_tv;
private boolean isLiteOsCheck;
private boolean isSupport41AF;
private boolean isSupportCustomDNS;
private ImageView iv_4G_version;
ImageView iv_conect_num;
ImageView iv_device_type;
private ImageView iv_dns1_dns2_line;
ImageView iv_dns_2;
private ImageView iv_dns_type_line;
ImageView iv_ipaddr;
ImageView iv_nettypeline;
private ImageView iv_single_4G;
ImageView iv_subnet_maskaddr;
LinearLayout ll_gunversion;
private LinearLayout ll_mic_version;
LinearLayout ll_nvrhardversion;
ImageView lm_gunversion;
ImageView lm_nvrhardversion;
private MyCamera mCamera;
private HiChipNVRDefines.NVR_IPC_SYSINFO mIpcsysinfo;
private TextView mTvdeviceType;
private TextView network_state_tv;
TextView nvrhardware_version_tv;
private HiChipNVRDefines.PLATFORM_S_NVR_PARAM_REP nvrsys;
private ProgressDialog progressDialog;
private RelativeLayout rl_4G_version;
RelativeLayout rl_conect_num;
private RelativeLayout rl_dns_0;
private RelativeLayout rl_dns_1;
private RelativeLayout rl_dns_2;
private RelativeLayout rl_dns_type;
RelativeLayout rl_gateway;
RelativeLayout rl_ipaddr;
RelativeLayout rl_net_type;
private RelativeLayout rl_single_4G;
RelativeLayout rl_subnet_maskaddr;
private TextView software_version_tv;
private TextView subnet_mask_tv;
private TextView tv_4G_version;
private TextView tv_mic_date;
private TextView tv_single_quality;
TextView tv_upgrade_online_settings;
private UpdateInfo updateInfo;
private TextView user_connections_tv;
private int updateStatus = 0;
boolean isUpdate = false;
private String redirectAddr = null;
private String address = "";
private String ptzNumber = "";
public int chn = 0;
private boolean nvrsinglechn = false;
private Handler handler = new AnonymousClass3();
private List<UpdateInfo> mListUpdataInfo = new ArrayList();
@Override
protected int setLayoutId() {
return R.layout.activity_device_info;
}
@Override
protected void init(Bundle bundle) {
String stringExtra = getIntent().getStringExtra(HiDataValue.EXTRAS_KEY_UID);
this.chn = getIntent().getIntExtra("nvrposition", -1);
this.nvrsinglechn = getIntent().getBooleanExtra("nvrsinglechn", false);
Iterator<MyCamera> it = HiDataValue.CameraList.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
MyCamera next = it.next();
if (stringExtra != null && stringExtra.equals(next.getUid())) {
this.mCamera = next;
if (next.getConnectState() == 4 && !this.mCamera.getIsDevNVR()) {
this.mCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_NET_PARAM, new byte[0]);
}
}
}
showjuHuaDialog();
initView();
if (this.mCamera.getIsDevNVR()) {
if (!this.nvrsinglechn) {
this.mCamera.sendIOCtrl(HiChipNVRDefines.HI_NVR_P2P_PLATFORM_GET_NVR_PARAM, new byte[0]);
this.ll_nvrhardversion.setVisibility(0);
this.lm_nvrhardversion.setVisibility(0);
this.rl_net_type.setVisibility(8);
this.rl_conect_num.setVisibility(8);
this.iv_nettypeline.setVisibility(8);
} else {
new HiChipNVRDefines.NVR_IPC_SYSINFO(new byte[264]);
this.mCamera.sendIOCtrl(HiChipNVRDefines.HI_NVR_P2P_PLATFORM_IPCSYSINFO, HiChipNVRDefines.NVR_IPC_SYSINFO.parseContent(this.chn));
this.rl_net_type.setVisibility(8);
this.rl_conect_num.setVisibility(8);
this.rl_ipaddr.setVisibility(8);
this.rl_subnet_maskaddr.setVisibility(8);
this.rl_gateway.setVisibility(8);
this.rl_dns_0.setVisibility(8);
this.iv_nettypeline.setVisibility(8);
this.iv_device_type.setVisibility(8);
this.iv_conect_num.setVisibility(8);
this.iv_ipaddr.setVisibility(8);
this.iv_subnet_maskaddr.setVisibility(8);
this.iv_dns_2.setVisibility(8);
}
if (this.mCamera.getNvrConnectLevel() == 0) {
this.tv_upgrade_online_settings.setVisibility(0);
}
} else {
handIsSup_DEV_INFO_EXT();
}
if (this.mCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_SIGNAL_QUALITY)) {
this.rl_single_4G.setVisibility(0);
this.iv_single_4G.setVisibility(0);
this.mCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_SIGNAL_QUALITY, new byte[0]);
this.rl_4G_version.setVisibility(0);
this.iv_4G_version.setVisibility(0);
this.mCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_VERSION_NO, new byte[0]);
}
if (this.mCamera.appGetCommandFunction(ConstantCommand.HI_P2P_GET_DEV_DNS_PARAM)) {
this.isSupportCustomDNS = true;
this.rl_dns_type.setVisibility(0);
this.iv_dns_type_line.setVisibility(0);
this.mCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_DEV_DNS_PARAM, new byte[0]);
return;
}
this.isSupportCustomDNS = false;
}
private void handIsSup_DEV_INFO_EXT() {
MyCamera myCamera = this.mCamera;
if (myCamera == null) {
return;
}
if (myCamera.appGetCommandFunction(ConstantCommand.HI_P2P_PTZ_GET_CONFIG_INFO)) {
this.mCamera.sendIOCtrl(ConstantCommand.HI_P2P_PTZ_GET_CONFIG_INFO, new byte[0]);
}
if (this.mCamera.appGetCommandFunction(HiChipDefines.HI_P2P_GET_DEV_INFO_EXT)) {
this.mCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_DEV_INFO_EXT, new byte[0]);
} else {
this.mCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_DEV_INFO, new byte[0]);
this.mCamera.sendIOCtrl(HiChipDefines.HI_P2P_GET_VENDOR_INFO, new byte[0]);
}
}
private void initView() {
TitleView titleView = (TitleView) findViewById(R.id.title_top);
titleView.setTitle(getResources().getString(R.string.title_equipment_information));
titleView.setButton(0);
titleView.setNavigationBarButtonListener(new TitleView.NavigationBarButtonListener() {
@Override
public void OnNavigationButtonClick(int i) {
if (i != 0) {
return;
}
NVRDeviceInfoActivity.this.finish();
}
});
this.device_name_tv = (TextView) findViewById(R.id.device_name_tv);
this.tv_mic_date = (TextView) findViewById(R.id.tv_mic_date);
this.network_state_tv = (TextView) findViewById(R.id.network_state_tv);
this.user_connections_tv = (TextView) findViewById(R.id.user_connections_tv);
this.software_version_tv = (TextView) findViewById(R.id.software_version_tv);
if (this.mCamera.getdevDual() && !this.mCamera.getIsLiteOs()) {
this.gunware_version_tv = (TextView) findViewById(R.id.gunware_version_tv);
if (this.mCamera.appGetCommandFunction(16873) && this.mCamera.appGetCommandFunction(HiChipDefines.HI_P2P_GET_DISPLAY_PARAM)) {
this.mCamera.sendIOCtrl(16873, new byte[0]);
} else {
this.ll_gunversion.setVisibility(0);
this.lm_gunversion.setVisibility(0);
}
}
this.mTvdeviceType = (TextView) findViewById(R.id.device_type);
this.tv_single_quality = (TextView) findViewById(R.id.tv_single_quality);
this.tv_4G_version = (TextView) findViewById(R.id.tv_4G_version);
this.rl_single_4G = (RelativeLayout) findViewById(R.id.rl_single_4G);
this.rl_4G_version = (RelativeLayout) findViewById(R.id.rl_4G_version);
this.iv_single_4G = (ImageView) findViewById(R.id.iv_single_4G);
this.iv_4G_version = (ImageView) findViewById(R.id.iv_4G_version);
this.ip_address_tv = (TextView) findViewById(R.id.ip_address_tv);
this.subnet_mask_tv = (TextView) findViewById(R.id.subnet_mask_tv);
this.gateway_tv = (TextView) findViewById(R.id.gateway_tv);
this.dns_tv = (TextView) findViewById(R.id.dns_tv);
this.ll_mic_version = (LinearLayout) findViewById(R.id.rl_mic_version);
this.rl_dns_type = (RelativeLayout) findViewById(R.id.rl_dns_type);
this.iv_dns_type_line = (ImageView) findViewById(R.id.iv_dns_type_line);
this.dns_type = (TextView) findViewById(R.id.dns_type);
this.dns_tv1 = (TextView) findViewById(R.id.dns_tv1);
this.dns_tv2 = (TextView) findViewById(R.id.dns_tv2);
this.rl_dns_0 = (RelativeLayout) findViewById(R.id.rl_dns_0);
this.rl_dns_1 = (RelativeLayout) findViewById(R.id.rl_dns_1);
this.rl_dns_2 = (RelativeLayout) findViewById(R.id.rl_dns_2);
this.iv_dns1_dns2_line = (ImageView) findViewById(R.id.iv_dns1_dns2_line);
MyCamera myCamera = this.mCamera;
if (myCamera != null && myCamera.getIsLiteOs()) {
this.ll_mic_version.setVisibility(0);
}
findViewById(R.id.rl_dev_name).setOnLongClickListener(new View.OnLongClickListener() {
@Override
public final boolean onLongClick(View view) {
return NVRDeviceInfoActivity.this.lambda$initView$0$NVRDeviceInfoActivity(view);
}
});
this.rl_dns_type.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(NVRDeviceInfoActivity.this, (Class<?>) ChooseDNSTypeActivity.class);
intent.putExtra(HiDataValue.EXTRAS_KEY_UID, NVRDeviceInfoActivity.this.mCamera.getUid());
if (NVRDeviceInfoActivity.this.dns_param != null) {
intent.putExtra("dns_type", NVRDeviceInfoActivity.this.dns_param.u32DnsDynFlag);
intent.putExtra("dns1", Packet.getString(NVRDeviceInfoActivity.this.dns_param.str_F_DNS_IP));
intent.putExtra("dns2", Packet.getString(NVRDeviceInfoActivity.this.dns_param.str_S_DNS_IP));
}
NVRDeviceInfoActivity.this.startActivityForResult(intent, 10010);
}
});
}
public boolean lambda$initView$0$NVRDeviceInfoActivity(View view) {
MyCamera myCamera = this.mCamera;
if (myCamera == null || !myCamera.getIsLiteOs()) {
return false;
}
Toast.makeText(this, " liteos setting debug ", 1).show();
LiteOsSettingActivity.isDebugModel = !LiteOsSettingActivity.isDebugModel;
return false;
}
@Override
public void receiveIOCtrlData(HiCamera hiCamera, int i, byte[] bArr, int i2) {
if (hiCamera != this.mCamera) {
return;
}
Bundle bundle = new Bundle();
bundle.putByteArray("data", bArr);
Message obtainMessage = this.handler.obtainMessage();
obtainMessage.what = HiDataValue.HANDLE_MESSAGE_RECEIVE_IOCTRL;
obtainMessage.obj = hiCamera;
obtainMessage.arg1 = i;
obtainMessage.arg2 = i2;
obtainMessage.setData(bundle);
this.handler.sendMessage(obtainMessage);
}
public class AnonymousClass3 extends Handler {
AnonymousClass3() {
}
@Override
public void handleMessage(Message message) {
int i = message.what;
if (i == -1879048191) {
NVRDeviceInfoActivity.this.handSession(message);
return;
}
if (i != -1879048189) {
if (i != NVRDeviceInfoActivity.GET_UPDATE_VERSION_NUM) {
if (i != 65536) {
return;
}
NVRDeviceInfoActivity.this.updateStatus = 0;
NVRDeviceInfoActivity.this.showDialogOld();
return;
}
if (message.arg1 == 1) {
if (NVRDeviceInfoActivity.this.mCamera != null) {
NVRDeviceInfoActivity.this.mCamera.registerIOSessionListener(NVRDeviceInfoActivity.this);
}
if (!NVRDeviceInfoActivity.this.mCamera.getIsDevNVR()) {
if (NVRDeviceInfoActivity.this.isSupport41AF) {
NVRDeviceInfoActivity.this.handleDeviceInfoNew();
return;
} else {
NVRDeviceInfoActivity.this.handleDeviceInfo();
return;
}
}
if (!NVRDeviceInfoActivity.this.nvrsinglechn) {
if (NVRDeviceInfoActivity.this.nvrsys != null) {
NVRDeviceInfoActivity.this.handleDeviceInfoNew();
return;
}
return;
} else {
if (NVRDeviceInfoActivity.this.mIpcsysinfo == null || NVRDeviceInfoActivity.this.chn <= -1 || NVRDeviceInfoActivity.this.chn >= 32) {
return;
}
if (NVRDeviceInfoActivity.this.mCamera.mNVRChildDev[NVRDeviceInfoActivity.this.chn].isSupport41AF) {
NVRDeviceInfoActivity.this.handleDeviceInfoNew();
return;
} else {
NVRDeviceInfoActivity.this.handleDeviceInfo();
return;
}
}
}
NVRDeviceInfoActivity.this.updateStatus = 0;
NVRDeviceInfoActivity nVRDeviceInfoActivity = NVRDeviceInfoActivity.this;
MyToast.showToast(nVRDeviceInfoActivity, nVRDeviceInfoActivity.getString(R.string.tips_update_system_failed));
NVRDeviceInfoActivity.this.dismissjuHuaDialog();
return;
}
if (message.arg2 == 0) {
byte[] byteArray = message.getData().getByteArray("data");
switch (message.arg1) {
case HiChipDefines.HI_P2P_GET_NET_PARAM:
NVRDeviceInfoActivity.this.dismissjuHuaDialog();
HiChipDefines.HI_P2P_S_NET_PARAM hi_p2p_s_net_param = new HiChipDefines.HI_P2P_S_NET_PARAM(byteArray);
String string = Packet.getString(hi_p2p_s_net_param.strIPAddr);
String string2 = Packet.getString(hi_p2p_s_net_param.strNetMask);
String string3 = Packet.getString(hi_p2p_s_net_param.strGateWay);
String string4 = Packet.getString(hi_p2p_s_net_param.strFDNSIP);
NVRDeviceInfoActivity.this.ip_address_tv.setText(string);
NVRDeviceInfoActivity.this.subnet_mask_tv.setText(string2);
NVRDeviceInfoActivity.this.gateway_tv.setText(string3);
if (NVRDeviceInfoActivity.this.isSupportCustomDNS) {
return;
}
NVRDeviceInfoActivity.this.dns_tv.setText(string4);
return;
case HiChipDefines.HI_P2P_GET_DEV_INFO_EXT:
NVRDeviceInfoActivity.this.dismissjuHuaDialog();
NVRDeviceInfoActivity.this.deviceInfo = new HiChipDefines.HI_P2P_GET_DEV_INFO_EXT(byteArray);
NVRDeviceInfoActivity.this.device_name_tv.setText(Packet.getString(NVRDeviceInfoActivity.this.deviceInfo.aszSystemName));
String[] stringArray = NVRDeviceInfoActivity.this.getResources().getStringArray(R.array.net_work_style);
HiLogcatUtil.e(NVRDeviceInfoActivity.this.mCamera.getUid() + "deviceInfo.strHardVer:" + Packet.getString(NVRDeviceInfoActivity.this.deviceInfo.strHardVer));
try {
NVRDeviceInfoActivity.this.network_state_tv.setText(stringArray[NVRDeviceInfoActivity.this.deviceInfo.u32NetType]);
} catch (Exception unused) {
NVRDeviceInfoActivity.this.network_state_tv.setText(stringArray[0]);
}
NVRDeviceInfoActivity.this.user_connections_tv.setText(NVRDeviceInfoActivity.this.deviceInfo.sUserNum + "");
NVRDeviceInfoActivity.this.mTvdeviceType.setText(Packet.getString(NVRDeviceInfoActivity.this.deviceInfo.aszSystemModel));
NVRDeviceInfoActivity.this.software_version_tv.setText(Packet.getString(NVRDeviceInfoActivity.this.deviceInfo.aszSystemSoftVersion));
if (NVRDeviceInfoActivity.this.mCamera.getdevDual() && !NVRDeviceInfoActivity.this.mCamera.getIsLiteOs()) {
NVRDeviceInfoActivity.this.gunware_version_tv.setText(Packet.getString(NVRDeviceInfoActivity.this.deviceInfo.strHardVer));
}
try {
byte[] bArr = new byte[8];
System.arraycopy(byteArray, 368, bArr, 0, 8);
String[] split = Packet.getHex(bArr, 8).split(" ");
String str = Integer.valueOf(split[0] + split[1], 16) + "";
String str2 = Integer.valueOf(split[2], 16) + "";
if (str2.length() == 1) {
str2 = PushConstants.PUSH_TYPE_NOTIFY + str2;
}
String str3 = Integer.valueOf(split[3], 16) + "";
if (str3.length() == 1) {
str3 = PushConstants.PUSH_TYPE_NOTIFY + str3;
}
String str4 = str + str2 + str3 + split[4] + split[5] + split[6] + split[7];
if (!TextUtils.isEmpty(NVRDeviceInfoActivity.this.ptzNumber)) {
str4 = str4 + "/" + NVRDeviceInfoActivity.this.ptzNumber;
}
NVRDeviceInfoActivity.this.tv_mic_date.setText(str4);
} catch (Exception unused2) {
NVRDeviceInfoActivity.this.tv_mic_date.setText("");
}
String string5 = Packet.getString(NVRDeviceInfoActivity.this.deviceInfo.aszSystemSoftVersion);
if (TextUtils.isEmpty(string5)) {
return;
}
NVRDeviceInfoActivity.this.handVersionAndView(string5);
return;
case CamHiDefines.HI_P2P_ALARM_ADDRESS_GET:
try {
CamHiDefines.HI_P2P_ALARM_ADDRESS hi_p2p_alarm_address = new CamHiDefines.HI_P2P_ALARM_ADDRESS(byteArray);
StringBuilder sb = new StringBuilder();
sb.append(NVRDeviceInfoActivity.this.mCamera.getUid());
sb.append("\n正确地址:");
NVRDeviceInfoActivity nVRDeviceInfoActivity2 = NVRDeviceInfoActivity.this;
sb.append(nVRDeviceInfoActivity2.getRightAddress(nVRDeviceInfoActivity2.mCamera, 1));
sb.append("\n设备上的地址:");
sb.append(Packet.getString(hi_p2p_alarm_address.szAlarmAddr));
if (NVRDeviceInfoActivity.this.mCamera.f987push != null) {
sb.append("\n推送绑定地址:");
sb.append(NVRDeviceInfoActivity.this.mCamera.f987push.getPushServer());
} else {
sb.append("\n推送绑定地址:设备未打开推送");
}
NVRDeviceInfoActivity.this.address = sb.toString();
return;
} catch (Exception e) {
e.printStackTrace();
return;
}
case 16873:
if (byteArray == null) {
return;
}
NVRDeviceInfoActivity.this.imagetype_param = new ConstantCommand.HI_P2P_GET_UNITE_IPC_IMAGETYPE_PARAM(byteArray);
if (NVRDeviceInfoActivity.this.imagetype_param.u8Type == 1 || NVRDeviceInfoActivity.this.imagetype_param.u8Type == 2) {
NVRDeviceInfoActivity.this.ll_gunversion.setVisibility(0);
NVRDeviceInfoActivity.this.lm_gunversion.setVisibility(0);
return;
} else {
NVRDeviceInfoActivity.this.ll_gunversion.setVisibility(8);
NVRDeviceInfoActivity.this.lm_gunversion.setVisibility(8);
return;
}
case HiChipDefines.HI_P2P_SET_DOWNLOAD:
NVRDeviceInfoActivity.this.dismissjuHuaDialog();
NVRDeviceInfoActivity.this.mCamera.isSystemState = 3;
new DialogUtilsCamHiPro(NVRDeviceInfoActivity.this).title(NVRDeviceInfoActivity.this.getText(R.string.tips_warning)).message(NVRDeviceInfoActivity.this.getText(R.string.tip_system_update)).cancelText(NVRDeviceInfoActivity.this.getString(R.string.got_it)).setCancelOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NVRDeviceInfoActivity.AnonymousClass3.this.lambda$handleMessage$0$NVRDeviceInfoActivity$3(view);
}
}).build().show();
return;
case HiChipDefines.HI_P2P_GET_DEV_INFO:
NVRDeviceInfoActivity.this.dismissjuHuaDialog();
HiChipDefines.HI_P2P_S_DEV_INFO hi_p2p_s_dev_info = new HiChipDefines.HI_P2P_S_DEV_INFO(byteArray);
String[] stringArray2 = NVRDeviceInfoActivity.this.getResources().getStringArray(R.array.net_work_style);
try {
NVRDeviceInfoActivity.this.network_state_tv.setText(stringArray2[hi_p2p_s_dev_info.u32NetType]);
} catch (Exception unused3) {
NVRDeviceInfoActivity.this.network_state_tv.setText(stringArray2[0]);
}
NVRDeviceInfoActivity.this.user_connections_tv.setText(hi_p2p_s_dev_info.sUserNum + "");
NVRDeviceInfoActivity.this.software_version_tv.setText(Packet.getString(hi_p2p_s_dev_info.strSoftVer));
String string6 = Packet.getString(hi_p2p_s_dev_info.strSoftVer);
if (TextUtils.isEmpty(string6)) {
return;
}
NVRDeviceInfoActivity.this.handVersionAndView(string6);
return;
case HiChipDefines.HI_P2P_GET_VENDOR_INFO:
NVRDeviceInfoActivity.this.dismissjuHuaDialog();
NVRDeviceInfoActivity.this.mTvdeviceType.setText(new String(new HiChipDefines.HI_P2P_S_VENDOR(byteArray).strProduct).trim());
return;
case ConstantCommand.HI_P2P_GET_SIGNAL_QUALITY:
ConstantCommand.HI_P2P_S_SIGNAL_QUALITY hi_p2p_s_signal_quality = new ConstantCommand.HI_P2P_S_SIGNAL_QUALITY(byteArray);
NVRDeviceInfoActivity.this.tv_single_quality.setText(hi_p2p_s_signal_quality.u32SignalQuality + "");
return;
case ConstantCommand.HI_P2P_GET_VERSION_NO:
String trim = new String(new ConstantCommand.HI_P2P_S_VERSION_NO(byteArray).sVersionNunber).trim();
if (TextUtils.isEmpty(trim)) {
return;
}
if (!trim.contains("\n")) {
NVRDeviceInfoActivity.this.tv_4G_version.setText(trim);
return;
}
String[] split2 = trim.split("\n");
if (split2[0] != null) {
NVRDeviceInfoActivity.this.tv_4G_version.setText(split2[0]);
return;
}
return;
case ConstantCommand.HI_P2P_PTZ_GET_CONFIG_INFO:
NVRDeviceInfoActivity.this.ptzNumber = new String(new ConstantCommand.HI_P2P_S_PTZ_CONFIG_PARAM(byteArray).sPtzVerNo).trim();
String trim2 = NVRDeviceInfoActivity.this.tv_mic_date.getText().toString().trim();
if (TextUtils.isEmpty(NVRDeviceInfoActivity.this.ptzNumber) || TextUtils.isEmpty(trim2) || trim2.endsWith(NVRDeviceInfoActivity.this.ptzNumber)) {
return;
}
NVRDeviceInfoActivity.this.tv_mic_date.setText(trim2 + "/" + NVRDeviceInfoActivity.this.ptzNumber);
return;
case ConstantCommand.HI_P2P_GET_DEV_DNS_PARAM:
NVRDeviceInfoActivity.this.dns_param = new ConstantCommand.HI_P2P_S_DEV_DNS_PARAM(byteArray);
if (NVRDeviceInfoActivity.this.dns_param.u32DnsDynFlag == 0) {
NVRDeviceInfoActivity.this.rl_dns_0.setVisibility(0);
NVRDeviceInfoActivity.this.rl_dns_1.setVisibility(8);
NVRDeviceInfoActivity.this.rl_dns_2.setVisibility(8);
NVRDeviceInfoActivity.this.iv_dns1_dns2_line.setVisibility(8);
NVRDeviceInfoActivity.this.dns_tv.setText(Packet.getString(NVRDeviceInfoActivity.this.dns_param.str_F_DNS_IP));
NVRDeviceInfoActivity.this.dns_type.setText(NVRDeviceInfoActivity.this.getString(R.string.automatic));
return;
}
NVRDeviceInfoActivity.this.rl_dns_0.setVisibility(8);
NVRDeviceInfoActivity.this.rl_dns_1.setVisibility(0);
NVRDeviceInfoActivity.this.rl_dns_2.setVisibility(0);
NVRDeviceInfoActivity.this.iv_dns1_dns2_line.setVisibility(0);
String string7 = Packet.getString(NVRDeviceInfoActivity.this.dns_param.str_F_DNS_IP);
String string8 = Packet.getString(NVRDeviceInfoActivity.this.dns_param.str_S_DNS_IP);
NVRDeviceInfoActivity.this.dns_tv1.setText(string7);
NVRDeviceInfoActivity.this.dns_tv2.setText(string8);
NVRDeviceInfoActivity.this.dns_type.setText(NVRDeviceInfoActivity.this.getString(R.string.g4_apn_model_manual));
return;
case HiChipNVRDefines.HI_NVR_P2P_PLATFORM_GET_NVR_PARAM:
NVRDeviceInfoActivity.this.dismissjuHuaDialog();
NVRDeviceInfoActivity.this.nvrsys = new HiChipNVRDefines.PLATFORM_S_NVR_PARAM_REP(byteArray);
HiLogcatUtil.e(Packet.getString(NVRDeviceInfoActivity.this.nvrsys.szDeviceName) + "::" + Packet.getString(NVRDeviceInfoActivity.this.nvrsys.szDeviceType) + "::" + Packet.getString(NVRDeviceInfoActivity.this.nvrsys.szSoftver) + "::" + Packet.getString(NVRDeviceInfoActivity.this.nvrsys.szHardVer) + "::" + Packet.getString(NVRDeviceInfoActivity.this.nvrsys.aszServerIP) + "::" + Packet.getString(NVRDeviceInfoActivity.this.nvrsys.aszNetMask) + "::" + Packet.getString(NVRDeviceInfoActivity.this.nvrsys.aszGateWay) + "::" + Packet.getString(NVRDeviceInfoActivity.this.nvrsys.aszMacAddr) + "::" + Packet.getString(NVRDeviceInfoActivity.this.nvrsys.aszFDNSIP) + "::" + Packet.getString(NVRDeviceInfoActivity.this.nvrsys.aszSDNSIP));
String string9 = Packet.getString(NVRDeviceInfoActivity.this.nvrsys.aszServerIP);
String string10 = Packet.getString(NVRDeviceInfoActivity.this.nvrsys.aszNetMask);
String string11 = Packet.getString(NVRDeviceInfoActivity.this.nvrsys.aszGateWay);
String string12 = Packet.getString(NVRDeviceInfoActivity.this.nvrsys.aszFDNSIP);
NVRDeviceInfoActivity.this.ip_address_tv.setText(string9);
NVRDeviceInfoActivity.this.subnet_mask_tv.setText(string10);
NVRDeviceInfoActivity.this.gateway_tv.setText(string11);
NVRDeviceInfoActivity.this.dns_tv.setText(string12);
NVRDeviceInfoActivity.this.mTvdeviceType.setText(Packet.getString(NVRDeviceInfoActivity.this.nvrsys.szDeviceType));
NVRDeviceInfoActivity.this.software_version_tv.setText(Packet.getString(NVRDeviceInfoActivity.this.nvrsys.szSoftver));
NVRDeviceInfoActivity.this.nvrhardware_version_tv.setText(Packet.getString(NVRDeviceInfoActivity.this.nvrsys.szHardVer));
NVRDeviceInfoActivity.this.device_name_tv.setText(Packet.getString(NVRDeviceInfoActivity.this.nvrsys.szDeviceName));
NVRDeviceInfoActivity.this.handVersionAndView(null);
return;
case HiChipNVRDefines.HI_NVR_P2P_PLATFORM_NVR_UPGRADE:
HiChipNVRDefines.PLATFORM_S_NVR_UPGRADE_REP platform_s_nvr_upgrade_rep = new HiChipNVRDefines.PLATFORM_S_NVR_UPGRADE_REP(byteArray);
HiLogcatUtil.e("" + platform_s_nvr_upgrade_rep.U32Rate);
NVRDeviceInfoActivity.this.mCamera.isSystemState = 3;
if (platform_s_nvr_upgrade_rep.U32Rate >= 100) {
NVRDeviceInfoActivity.this.dismissLoadDialog();
NVRDeviceInfoActivity.this.dismissjuHuaDialog();
return;
}
return;
default:
return;
}
}
NVRDeviceInfoActivity.this.dismissjuHuaDialog();
if (message.arg1 != 18433) {
return;
}
NVRDeviceInfoActivity nVRDeviceInfoActivity3 = NVRDeviceInfoActivity.this;
Toast.makeText(nVRDeviceInfoActivity3, nVRDeviceInfoActivity3.getString(R.string.update_fail), 1).show();
}
public void lambda$handleMessage$0$NVRDeviceInfoActivity$3(View view) {
NVRDeviceInfoActivity.this.startActivity(new Intent(NVRDeviceInfoActivity.this, (Class<?>) MainActivity.class));
}
}
public void handSession(Message message) {
if (message.arg1 != 4) {
return;
}
this.mCamera.setReconnectTimes(10);
dismissjuHuaDialog();
this.mCamera.isSystemState = 0;
startActivity(new Intent(this, (Class<?>) MainActivity.class));
}
@Override
public void receiveSessionState(HiCamera hiCamera, int i) {
if (hiCamera != this.mCamera) {
return;
}
Message obtain = Message.obtain();
obtain.what = HiDataValue.HANDLE_MESSAGE_SESSION_STATE;
obtain.arg1 = i;
this.handler.sendMessage(obtain);
}
@Override
public void onResume() {
super.onResume();
MyCamera myCamera = this.mCamera;
if (myCamera != null) {
myCamera.registerIOSessionListener(this);
}
}
@Override
public void onPause() {
super.onPause();
MyCamera myCamera = this.mCamera;
if (myCamera != null) {
myCamera.unregisterIOSessionListener(this);
}
}
public void handVersionAndView(String str) {
int i;
Log.i("tedu", " dev version: " + str);
if (!this.mCamera.getIsDevNVR()) {
this.isSupport41AF = this.mCamera.appGetCommandFunction(ConstantCommand.HI_P2P_SUPPORT_NEW_UPDATE);
Log.i("tedu", " dev isSupportNewUpdate(41af): " + this.isSupport41AF);
if (this.mCamera.mIsLiteOs) {
if (!this.mCamera.getIsAPRunMode()) {
this.tv_upgrade_online_settings.setVisibility(0);
this.isLiteOsCheck = true;
}
} else if (this.isSupport41AF) {
this.tv_upgrade_online_settings.setVisibility(0);
} else {
update_old(str);
}
} else {
int i2 = this.chn;
if (i2 < 32 && i2 > -1) {
HiLogcatUtil.e(this.mCamera.getUid() + ":::" + this.chn + "::" + this.mCamera.mNVRChildDev[this.chn].isSupport41AF + "::" + this.mCamera.mNVRChildDev[4].isSupport41AF);
}
if (!this.nvrsinglechn || ((i = this.chn) < 32 && i > -1 && this.mCamera.mNVRChildDev[this.chn].isSupport41AF)) {
this.tv_upgrade_online_settings.setVisibility(0);
} else {
HiChipNVRDefines.NVR_IPC_SYSINFO nvr_ipc_sysinfo = this.mIpcsysinfo;
if (nvr_ipc_sysinfo != null) {
String str2 = null;
if (this.deviceInfo != null && nvr_ipc_sysinfo.aszSystemModel != null) {
str2 = Packet.getString(this.mIpcsysinfo.aszSystemModel);
}
if (str2 != null && str2.startsWith("C9") && str2.contains("Z0")) {
this.tv_upgrade_online_settings.setVisibility(0);
}
String[] split = Packet.getString(this.mIpcsysinfo.aszSystemSoftVersion).split("\\.");
if (split.length < 2) {
Log.e("tedu", "strings.length < 2");
return;
} else if (split[0].equals("V11") && split[1].equals("1") && split[2].equals("8")) {
this.tv_upgrade_online_settings.setVisibility(0);
}
}
}
}
this.tv_upgrade_online_settings.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NVRDeviceInfoActivity.this.lambda$handVersionAndView$1$NVRDeviceInfoActivity(view);
}
});
}
public void lambda$handVersionAndView$1$NVRDeviceInfoActivity(View view) {
if (this.updateStatus == 0) {
showjuHuaDialog();
checkUpdate();
}
}
private void update_old(String str) {
String[] split = str.split("\\.");
if (split.length < 2) {
Log.e("tedu", "strings.length < 2");
return;
}
Log.e("tedu", this.mCamera.getChipVersion() + "");
int chipVersion = this.mCamera.getChipVersion();
if (chipVersion == 0) {
if (split[0].equals("V11") && split[1].equals("1") && split[2].equals("8")) {
this.tv_upgrade_online_settings.setVisibility(0);
return;
}
return;
}
if (chipVersion != 1) {
return;
}
String str2 = null;
HiChipDefines.HI_P2P_GET_DEV_INFO_EXT hi_p2p_get_dev_info_ext = this.deviceInfo;
if (hi_p2p_get_dev_info_ext != null && hi_p2p_get_dev_info_ext.aszSystemModel != null) {
str2 = Packet.getString(this.deviceInfo.aszSystemModel);
}
if (str2 != null && str2.startsWith("C9") && str2.contains("Z0")) {
this.tv_upgrade_online_settings.setVisibility(0);
}
}
private void checkUpdate() {
new ThreadHttpResqust().start();
this.updateStatus = 1;
}
public class UpdateInfo {
String url;
String ver;
public UpdateInfo(String str, String str2) {
this.url = str;
this.ver = str2;
}
}
public class ThreadHttpResqust extends Thread {
public ThreadHttpResqust() {
}
@Override
public void run() {
try {
HttpResponse execute = new DefaultHttpClient().execute(new HttpGet(NVRDeviceInfoActivity.LiteOsDownloadUrl));
if (execute.getStatusLine().getStatusCode() == 200) {
String entityUtils = EntityUtils.toString(execute.getEntity());
HiLogcatUtil.e("version online:" + entityUtils);
try {
JSONArray jSONArray = new JSONObject(entityUtils).getJSONArray(XmlErrorCodes.LIST);
for (int i = 0; i < jSONArray.length(); i++) {
JSONObject jSONObject = jSONArray.getJSONObject(i);
NVRDeviceInfoActivity.this.mListUpdataInfo.add(new UpdateInfo(jSONObject.getString("url"), jSONObject.getString("ver")));
}
} catch (JSONException e) {
e.printStackTrace();
}
if (NVRDeviceInfoActivity.this.mListUpdataInfo.size() > 0) {
Message message = new Message();
message.what = NVRDeviceInfoActivity.GET_UPDATE_VERSION_NUM;
message.arg1 = 1;
NVRDeviceInfoActivity.this.handler.sendMessage(message);
return;
}
}
Message message2 = new Message();
message2.what = NVRDeviceInfoActivity.GET_UPDATE_VERSION_NUM;
message2.arg1 = 0;
NVRDeviceInfoActivity.this.handler.sendMessage(message2);
} catch (Exception unused) {
Message message3 = new Message();
message3.what = NVRDeviceInfoActivity.GET_UPDATE_VERSION_NUM;
message3.arg1 = 0;
NVRDeviceInfoActivity.this.handler.sendMessage(message3);
}
}
}
private static String getString(byte[] bArr) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bArr.length && bArr[i] != 0; i++) {
sb.append((char) bArr[i]);
}
return sb.toString();
}
public void handleDeviceInfoNew() {
String string;
Date date;
if (!this.mCamera.getIsDevNVR()) {
string = getString(this.mCamera.getDeciveInfo().aszSystemSoftVersion);
} else if (this.nvrsinglechn) {
string = Packet.getString(this.mIpcsysinfo.aszSystemSoftVersion);
} else {
string = Packet.getString(this.nvrsys.szSoftver);
}
Log.i("tedu", "handleDeviceInfoNew: softVersion: " + string);
if (string.contains(Constants.ACCEPT_TIME_SEPARATOR_SERVER)) {
String[] split = string.split(Constants.ACCEPT_TIME_SEPARATOR_SERVER);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd", Locale.getDefault());
try {
Log.i("tedu", "dev date: " + split[1]);
date = simpleDateFormat.parse(split[1]);
} catch (ParseException e) {
e.printStackTrace();
date = null;
}
Iterator<UpdateInfo> it = this.mListUpdataInfo.iterator();
Date date2 = null;
while (true) {
if (!it.hasNext()) {
break;
}
UpdateInfo next = it.next();
if (next.ver.contains(Constants.ACCEPT_TIME_SEPARATOR_SERVER)) {
String[] split2 = next.ver.split(Constants.ACCEPT_TIME_SEPARATOR_SERVER);
try {
date2 = simpleDateFormat.parse(split2[1]);
} catch (ParseException e2) {
e2.printStackTrace();
}
if (split[0].equals(split2[0]) && date != null && date2 != null && date2.after(date)) {
Log.i("tedu", "new date: " + split2[1]);
Log.i("tedu", "find new version: " + next.ver + " ------- " + next.url);
this.updateInfo = next;
this.isUpdate = true;
break;
}
}
}
if (this.isUpdate) {
if (this.updateInfo == null) {
return;
}
if (!this.mCamera.getIsDevNVR()) {
this.redirectAddr = this.updateInfo.url + this.updateInfo.ver + ".exe";
} else if (!this.nvrsinglechn) {
this.redirectAddr = this.updateInfo.url + this.updateInfo.ver + ".exe";
} else {
this.redirectAddr = this.updateInfo.url + this.updateInfo.ver + ".exe";
}
new ThreadCheckRedirect().start();
return;
}
showDialogNew();
this.updateStatus = 0;
}
}
public void handleDeviceInfo() {
String string;
HiChipNVRDefines.NVR_IPC_SYSINFO nvr_ipc_sysinfo;
if (!this.mCamera.getIsDevNVR()) {
string = getString(this.mCamera.getDeciveInfo().aszSystemSoftVersion);
} else {
string = (!this.nvrsinglechn || (nvr_ipc_sysinfo = this.mIpcsysinfo) == null) ? "" : getString(nvr_ipc_sysinfo.aszSystemSoftVersion);
}
if (string.isEmpty() || string.length() < 3) {
return;
}
if (this.isLiteOsCheck) {
try {
if (string.contains(Constants.ACCEPT_TIME_SEPARATOR_SERVER)) {
String str = string.split(Constants.ACCEPT_TIME_SEPARATOR_SERVER)[0];
int length = str.length() - 1;
while (true) {
if (length <= -1) {
length = 0;
break;
} else if (str.charAt(length) == 'V') {
break;
} else {
length--;
}
}
string = string.substring(length, string.length());
}
} catch (Exception e) {
e.printStackTrace();
}
if ((TextUtils.isEmpty(string) || !string.startsWith("V")) && string.contains("_V")) {
string = string.substring(string.indexOf("_V") + 1, string.length());
}
Log.d("camhipro", string);
}
for (UpdateInfo updateInfo : this.mListUpdataInfo) {
String[] split = updateInfo.ver.split("\\.");
String[] split2 = string.split("\\.");
Log.d("camhipro", Arrays.toString(split));
Log.d("camhipro", Arrays.toString(split2));
if (split.length == split2.length && split2.length == 5) {
int i = 0;
while (true) {
if (i >= split.length) {
break;
}
if (i == split.length - 1) {
String[] split3 = split[i].split(Constants.ACCEPT_TIME_SEPARATOR_SERVER);
String[] split4 = split2[i].split(Constants.ACCEPT_TIME_SEPARATOR_SERVER);
if ((split3.length >= 1 ? Integer.parseInt(split3[0]) : 0) > (split4.length >= 1 ? Integer.parseInt(split4[0]) : 0)) {
this.updateInfo = updateInfo;
this.isUpdate = true;
}
} else if (!split2[i].equals(split[i])) {
this.isUpdate = false;
break;
}
i++;
}
}
if (this.isUpdate) {
break;
}
}
if (this.isUpdate) {
if (this.updateInfo == null) {
return;
}
this.redirectAddr = this.updateInfo.url + this.updateInfo.ver + ".exe";
new ThreadCheckRedirect().start();
return;
}
showDialogNew();
this.updateStatus = 0;
}
public class ThreadCheckRedirect extends Thread {
private ThreadCheckRedirect() {
}
@Override
public void run() {
Message message;
int i;
Socket socket;
String readLine;
Socket socket2 = null;
String str = null;
Socket socket3 = null;
Socket socket4 = null;
try {
try {
UpdateInfo unused = NVRDeviceInfoActivity.this.updateInfo;
System.out.println("updateInfo:" + NVRDeviceInfoActivity.this.updateInfo);
System.out.println("updateInfo.url:" + NVRDeviceInfoActivity.this.updateInfo.url);
i = 80;
socket = new Socket();
} catch (Throwable th) {
th = th;
}
} catch (UnknownHostException e) {
e = e;
} catch (IOException e2) {
e = e2;
}
try {
socket.setReuseAddress(true);
Matcher matcher = Pattern.compile("(?<=//|)((\\w)+\\.)+\\w+(:\\d{0,5})?").matcher(NVRDeviceInfoActivity.this.updateInfo.url);
if (matcher.find()) {
str = matcher.group();
System.out.println("host2:" + str);
}
if (str.contains(Constants.COLON_SEPARATOR)) {
String[] split = str.split(Constants.COLON_SEPARATOR);
String str2 = split[0];
int parseInt = Integer.parseInt(split[1]);
System.out.println("---00port: " + split[0]);
System.out.println("---port: " + parseInt);
str = str2;
i = parseInt;
}
socket.connect(new InetSocketAddress(str, i));
DataOutputStream dataOutputStream = new DataOutputStream(socket.getOutputStream());
String str3 = (((((("GET /" + NVRDeviceInfoActivity.this.updateInfo.ver + ".exe HTTP/1.1\r\n") + "Accept: */*\r\n") + "Accept-Language: zh-cn\r\n") + "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)\r\n") + "Host: " + str + "\r\n") + "Connection: Keep-Alive\r\n") + "\r\n";
System.out.println("sendhead:" + str3);
dataOutputStream.write(str3.getBytes());
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
while (true) {
readLine = bufferedReader.readLine();
System.out.println("in.readLine:" + readLine);
if (readLine.contains("HTTP/")) {
if (!readLine.contains("302") && !readLine.contains("301")) {
break;
} else {
System.out.println("------------ 301 302 Found----------------");
}
}
if (readLine.contains("Location:")) {
String trim = readLine.substring(9).trim();
System.out.println("1------------ newhttp----------------:" + trim);
NVRDeviceInfoActivity nVRDeviceInfoActivity = NVRDeviceInfoActivity.this;
readLine = readLine.substring(9).trim();
nVRDeviceInfoActivity.redirectAddr = readLine;
break;
}
}
dataOutputStream.close();
bufferedReader.close();
try {
socket.close();
} catch (IOException unused2) {
}
message = new Message();
socket2 = readLine;
} catch (UnknownHostException e3) {
e = e3;
socket3 = socket;
e.printStackTrace();
if (socket3 != null) {
try {
socket3.close();
} catch (IOException unused3) {
}
}
message = new Message();
socket2 = socket3;
message.what = 65536;
message.arg1 = 1;
NVRDeviceInfoActivity.this.handler.sendMessage(message);
} catch (IOException e4) {
e = e4;
socket4 = socket;
e.printStackTrace();
if (socket4 != null) {
try {
socket4.close();
} catch (IOException unused4) {
}
}
message = new Message();
socket2 = socket4;
message.what = 65536;
message.arg1 = 1;
NVRDeviceInfoActivity.this.handler.sendMessage(message);
} catch (Throwable th2) {
th = th2;
socket2 = socket;
if (socket2 != null) {
try {
socket2.close();
} catch (IOException unused5) {
}
}
Message message2 = new Message();
message2.what = 65536;
message2.arg1 = 1;
NVRDeviceInfoActivity.this.handler.sendMessage(message2);
throw th;
}
message.what = 65536;
message.arg1 = 1;
NVRDeviceInfoActivity.this.handler.sendMessage(message);
}
}
private void showDialogNew() {
dismissjuHuaDialog();
MyCamera myCamera = this.mCamera;
if (myCamera != null) {
myCamera.unregisterIOSessionListener(this);
}
new DialogUtilsCamHiPro(this).title(getText(R.string.tips_warning)).message(getText(R.string.tip_system_update_new)).cancelText(getString(R.string.got_it)).build().show();
}
public void showDialogOld() {
dismissjuHuaDialog();
new DialogUtilsCamHiPro(this).title(getText(R.string.tips_warning)).message(getText(R.string.tip_system_update_old)).sureText(getString(R.string.sure)).cancelText(getString(R.string.cancel)).setSureOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
NVRDeviceInfoActivity.this.lambda$showDialogOld$2$NVRDeviceInfoActivity(view);
}
}).build().show();
}
public void lambda$showDialogOld$2$NVRDeviceInfoActivity(View view) {
String str = this.redirectAddr;
byte[] bArr = new byte[128];
byte[] bytes = str.getBytes();
System.arraycopy(bytes, 0, bArr, 0, bytes.length <= 128 ? bytes.length : 128);
HiLog.v("dl:" + str);
MyCamera myCamera = this.mCamera;
if (myCamera != null) {
myCamera.registerIOSessionListener(this);
}
showjuHuaDialog(false);
this.mCamera.setReconnectTimes(20);
if (!this.mCamera.getIsDevNVR()) {
this.mCamera.sendIOCtrl(HiChipDefines.HI_P2P_SET_DOWNLOAD, HiChipDefines.HI_P2P_S_SET_DOWNLOAD.parseContent(0, bArr));
return;
}
HiLogcatUtil.e(this.mCamera.getUid() + this.redirectAddr);
if (!this.nvrsinglechn) {
this.mCamera.sendIOCtrl(HiChipNVRDefines.HI_NVR_P2P_PLATFORM_NVR_UPGRADE, HiChipNVRDefines.PLATFORM_S_NVR_UPGRADE_REQ.parseContent(this.updateInfo.url.getBytes(), (this.updateInfo.ver + ".exe").getBytes()));
return;
}
this.mCamera.sendIOCtrl(HiChipNVRDefines.HI_NVR_P2P_PLATFORM_IPCUPGRADE, HiChipNVRDefines.NVR_IPC_UPGRADE.parseContent(this.chn, this.redirectAddr.getBytes()));
}
public String getRightAddress(MyCamera myCamera, int i) {
if (myCamera.getIsLiteOs()) {
return Constant.LOW_POWER_ALARM_ADDRESS;
}
if ((i != 1 || (!myCamera.getUid().startsWith("W") && !myCamera.getUid().startsWith("T") && !myCamera.getUid().startsWith("U") && !myCamera.getUid().startsWith(Constant.X) && !myCamera.getUid().startsWith(Constant.Y) && !myCamera.getUid().startsWith("Z") && !myCamera.getUid().startsWith("S") && !myCamera.getUid().startsWith("M"))) && i == 0 && !myCamera.getUid().startsWith("W") && !myCamera.getUid().startsWith("T") && myCamera.getUid().startsWith("U")) {
}
return "120.24.179.113";
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (i == 10010 && i2 == -1) {
this.mCamera.sendIOCtrl(ConstantCommand.HI_P2P_GET_DEV_DNS_PARAM, new byte[0]);
}
}
}