git-svn-id: http://192.168.1.226/svn/proxy@961 454eff88-639b-444f-9e54-f578c98de674
| | |
| | | |
| | | import cn.com.basic.face.discern.common.CommonVariables; |
| | | import cn.com.basic.face.discern.entity.Device; |
| | | import cn.com.basic.face.discern.query.item.DeviceQueryItem; |
| | | import cn.com.basic.face.service.InternetAccessThread; |
| | | import cn.com.basic.face.service.DictionaryMng; |
| | | |
| | |
| | | } |
| | | |
| | | private Device androidDevice; |
| | | private Device camera1; |
| | | private Device camera2; |
| | | private DeviceQueryItem camera1; |
| | | private DeviceQueryItem camera2; |
| | | |
| | | |
| | | public static boolean deviceAvailable = false; |
| | |
| | | } |
| | | } |
| | | |
| | | public void setCamera1(Device camera1) { |
| | | public void setCamera1(DeviceQueryItem camera1) { |
| | | this.camera1 = camera1; |
| | | if (camera1 != null && camera1.getDeviceId() != null && !"".equals(camera1.getDeviceId())) { |
| | | DictionaryMng.getInstance().loadAllDictionaryData(); |
| | | } |
| | | } |
| | | |
| | | public void setCamera2(Device camera2) { |
| | | public void setCamera2(DeviceQueryItem camera2) { |
| | | this.camera2 = camera2; |
| | | if (camera2 != null && camera2.getDeviceId() != null && !"".equals(camera2.getDeviceId())) { |
| | | DictionaryMng.getInstance().loadAllDictionaryData(); |
| | |
| | | package cn.com.basic.face.discern.entity;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
|
| | | import cn.com.basic.face.discern.common.BaseEntity;
|
| | |
|
| | |
| | | * 设备所在机构id
|
| | | */
|
| | | public static final String deviceCompanyId = "deviceCompanyId";
|
| | | /**
|
| | | * 数据是否有效
|
| | | */
|
| | | public static final String isValid = "isValid";
|
| | | /**
|
| | | * 创建时间
|
| | | */
|
| | | public static final String createTime = "createTime";
|
| | | /**
|
| | | * 摄像头品牌
|
| | | */
|
| | | public static final String brand = "brand";
|
| | | /**
|
| | | * 分辨率
|
| | | */
|
| | | public static final String resolution = "resolution";
|
| | | }
|
| | |
|
| | | // 设备主键
|
| | |
| | | private String isSynchron;
|
| | | // 设备所在机构id
|
| | | private String deviceCompanyId;
|
| | |
|
| | | // 数据是否有效
|
| | | private String isValid;
|
| | |
|
| | | // 创建时间
|
| | | private String createTime;
|
| | |
|
| | | public String getIsValid() {
|
| | | return isValid;
|
| | | }
|
| | |
|
| | | public void setIsValid(String isValid) {
|
| | | this.isValid = isValid;
|
| | | }
|
| | |
|
| | | public String getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(String createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | | // 摄像头品牌
|
| | | private String brand;
|
| | | // 分辨率
|
| | | private String resolution;
|
| | |
|
| | | /**
|
| | | * Get 设备主键
|
| | |
| | |
|
| | | /**
|
| | | * Get 是否同步
|
| | | * ,Y--已同步,N--未同步
|
| | | * ,Y-已同步,N-未同步
|
| | | */
|
| | | public String getIsSynchron() {
|
| | | return isSynchron;
|
| | |
| | |
|
| | | /**
|
| | | * Set 是否同步
|
| | | * ,Y--已同步,N--未同步
|
| | | * ,Y-已同步,N-未同步
|
| | | */
|
| | | public void setIsSynchron(String isSynchron) {
|
| | | this.isSynchron = isSynchron;
|
| | |
| | | this.deviceCompanyId = deviceCompanyId;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get 数据是否有效
|
| | | * ,作为软删除的判断条件,1-有效,0-无效
|
| | | */
|
| | | public String getIsValid() {
|
| | | return isValid;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Set 数据是否有效
|
| | | * ,作为软删除的判断条件,1-有效,0-无效
|
| | | */
|
| | | public void setIsValid(String isValid) {
|
| | | this.isValid = isValid;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get 创建时间
|
| | | */
|
| | | public String getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Set 创建时间
|
| | | */
|
| | | public void setCreateTime(String createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get 摄像头品牌
|
| | | */
|
| | | public String getBrand() {
|
| | | return brand;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Set 摄像头品牌
|
| | | */
|
| | | public void setBrand(String brand) {
|
| | | this.brand = brand;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get 分辨率
|
| | | */
|
| | | public String getResolution() {
|
| | | return resolution;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Set 分辨率
|
| | | */
|
| | | public void setResolution(String resolution) {
|
| | | this.resolution = resolution;
|
| | | }
|
| | |
|
| | | public String toString() {
|
| | | return |
| | | ",设备主键 =" + deviceId + ",设备所属公司 ="+ companyId + ",设备名称 =" + deviceName + |
| | | ",设备类型 =" + type + ",设备地址 =" + installAddress + ",学校名称 =" + schoolName + |
| | | ",品牌 =" + brandId + ",IP =" + ip + ",端口 =" + port + |
| | | ",分辨率 =" + resolutionId + ",用户名 =" + username + ",密码 =" + password + |
| | | ",通讯协议 =" + protocolId + ",序列号 =" + sn + ",所属设备id ="+ belongId + |
| | | ",负责人 =" + principal + ",安装时间 =" + installTime + ",安装公司 =" + installCompany + |
| | | ",生产厂家 =" + manufacturer + ",生产日期 =" + productionDate + ",备注 =" + remark + |
| | | ",报废日期 =" + scrappedDate + ",设备id =" + snId + ",同步时间 =" + updateTime + |
| | | ",是否同步 =" + isSynchron + ",设备所在机构id ="+ deviceCompanyId;
|
| | | return
|
| | | ",设备主键 =" + deviceId + ",设备所属公司 ="+ companyId + ",设备名称 =" + deviceName +
|
| | | ",设备类型 =" + type + ",设备地址 =" + installAddress + ",学校名称 =" + schoolName +
|
| | | ",品牌 =" + brandId + ",IP =" + ip + ",端口 =" + port +
|
| | | ",分辨率 =" + resolutionId + ",用户名 =" + username + ",密码 =" + password +
|
| | | ",通讯协议 =" + protocolId + ",序列号 =" + sn + ",所属设备id ="+ belongId +
|
| | | ",负责人 =" + principal + ",安装时间 =" + installTime + ",安装公司 =" + installCompany +
|
| | | ",生产厂家 =" + manufacturer + ",生产日期 =" + productionDate + ",备注 =" + remark +
|
| | | ",报废日期 =" + scrappedDate + ",设备id =" + snId + ",同步时间 =" + updateTime +
|
| | | ",是否同步 =" + isSynchron + ",设备所在机构id ="+ deviceCompanyId + ",数据是否有效 ="+ isValid +
|
| | | ",创建时间 =" + createTime + ",摄像头品牌 ="+ brand + ",分辨率 =" + resolution
|
| | | ;
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | public class DeviceQueryItem {
|
| | |
|
| | | // |
| | | // 设备主键
|
| | | private String deviceId;
|
| | | // |
| | | // 设备所属公司
|
| | | private String companyId;
|
| | | // |
| | | // 设备名称
|
| | | private String deviceName;
|
| | | // |
| | | // 设备类型:camera1, camera2, main_device
|
| | | private String type;
|
| | | // |
| | | private String address;
|
| | | // |
| | | // 设备地址
|
| | | private String installAddress;
|
| | | // 学校名称
|
| | | private String schoolName;
|
| | | // |
| | | // 品牌
|
| | | private String brandId;
|
| | | // |
| | | // IP
|
| | | private String ip;
|
| | | // |
| | | // 端口
|
| | | private String port;
|
| | | // |
| | | // 分辨率
|
| | | private String resolutionId;
|
| | | // |
| | | // 用户名
|
| | | private String username;
|
| | | // |
| | | // 密码
|
| | | private String password;
|
| | | // |
| | | // 通讯协议
|
| | | private String protocolId;
|
| | | // |
| | | // 序列号
|
| | | private String sn;
|
| | | // |
| | | // 所属设备id
|
| | | private String belongId;
|
| | | // 名称
|
| | | private String brandName;
|
| | | // 名称
|
| | | private String resolution;
|
| | | // 名称
|
| | | private String protocol;
|
| | |
|
| | | /**
|
| | | * Get |
| | | * Get 设备主键
|
| | | */
|
| | | public String getDeviceId() {
|
| | | return deviceId;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Set |
| | | * Set 设备主键
|
| | | */
|
| | | public void setDeviceId(String deviceId) {
|
| | | this.deviceId = deviceId;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get |
| | | * Get 设备所属公司
|
| | | */
|
| | | public String getCompanyId() {
|
| | | return companyId;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Set |
| | | * Set 设备所属公司
|
| | | */
|
| | | public void setCompanyId(String companyId) {
|
| | | this.companyId = companyId;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get |
| | | * Get 设备名称
|
| | | */
|
| | | public String getDeviceName() {
|
| | | return deviceName;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Set |
| | | * Set 设备名称
|
| | | */
|
| | | public void setDeviceName(String deviceName) {
|
| | | this.deviceName = deviceName;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get |
| | | * Get 设备类型:camera1, camera2, main_device
|
| | | */
|
| | | public String getType() {
|
| | | return type;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Set |
| | | * Set 设备类型:camera1, camera2, main_device
|
| | | */
|
| | | public void setType(String type) {
|
| | | this.type = type;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get |
| | | * Get 设备地址
|
| | | */
|
| | | public String getAddress() {
|
| | | return address;
|
| | | }
|
| | | |
| | | /**
|
| | | * Set |
| | | */
|
| | | public void setAddress(String address) {
|
| | | this.address = address;
|
| | | public String getInstallAddress() {
|
| | | return installAddress;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get |
| | | * Set 设备地址
|
| | | */
|
| | | public void setInstallAddress(String installAddress) {
|
| | | this.installAddress = installAddress;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get 学校名称
|
| | | */
|
| | | public String getSchoolName() {
|
| | | return schoolName;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Set |
| | | * Set 学校名称
|
| | | */
|
| | | public void setSchoolName(String schoolName) {
|
| | | this.schoolName = schoolName;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get |
| | | * Get 品牌
|
| | | */
|
| | | public String getBrandId() {
|
| | | return brandId;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Set |
| | | * Set 品牌
|
| | | */
|
| | | public void setBrandId(String brandId) {
|
| | | this.brandId = brandId;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get |
| | | * Get IP
|
| | | */
|
| | | public String getIp() {
|
| | | return ip;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Set |
| | | * Set IP
|
| | | */
|
| | | public void setIp(String ip) {
|
| | | this.ip = ip;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get |
| | | * Get 端口
|
| | | */
|
| | | public String getPort() {
|
| | | return port;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Set |
| | | * Set 端口
|
| | | */
|
| | | public void setPort(String port) {
|
| | | this.port = port;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get |
| | | * Get 分辨率
|
| | | */
|
| | | public String getResolutionId() {
|
| | | return resolutionId;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Set |
| | | * Set 分辨率
|
| | | */
|
| | | public void setResolutionId(String resolutionId) {
|
| | | this.resolutionId = resolutionId;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get |
| | | * Get 用户名
|
| | | */
|
| | | public String getUsername() {
|
| | | return username;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Set |
| | | * Set 用户名
|
| | | */
|
| | | public void setUsername(String username) {
|
| | | this.username = username;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get |
| | | * Get 密码
|
| | | */
|
| | | public String getPassword() {
|
| | | return password;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Set |
| | | * Set 密码
|
| | | */
|
| | | public void setPassword(String password) {
|
| | | this.password = password;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get |
| | | * Get 通讯协议
|
| | | */
|
| | | public String getProtocolId() {
|
| | | return protocolId;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Set |
| | | * Set 通讯协议
|
| | | */
|
| | | public void setProtocolId(String protocolId) {
|
| | | this.protocolId = protocolId;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get |
| | | * Get 序列号
|
| | | */
|
| | | public String getSn() {
|
| | | return sn;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Set |
| | | * Set 序列号
|
| | | */
|
| | | public void setSn(String sn) {
|
| | | this.sn = sn;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get |
| | | * Get 所属设备id
|
| | | */
|
| | | public String getBelongId() {
|
| | | return belongId;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * Set |
| | | * Set 所属设备id
|
| | | */
|
| | | public void setBelongId(String belongId) {
|
| | | this.belongId = belongId;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get 名称
|
| | | */
|
| | | public String getBrandName() {
|
| | | return brandName;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Set 名称
|
| | | */
|
| | | public void setBrandName(String brandName) {
|
| | | this.brandName = brandName;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get 名称
|
| | | */
|
| | | public String getResolution() {
|
| | | return resolution;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Set 名称
|
| | | */
|
| | | public void setResolution(String resolution) {
|
| | | this.resolution = resolution;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Get 名称
|
| | | */
|
| | | public String getProtocol() {
|
| | | return protocol;
|
| | | }
|
| | |
|
| | | /**
|
| | | * Set 名称
|
| | | */
|
| | | public void setProtocol(String protocol) {
|
| | | this.protocol = protocol;
|
| | | }
|
| | |
|
| | | public String toString() {
|
| | | return |
| | | ", =" + deviceId + ", =" + companyId + ", =" + deviceName + |
| | | ", =" + type + ", =" + address + ", =" + schoolName + |
| | | ", =" + brandId + ", =" + ip + ", =" + port + |
| | | ", =" + resolutionId + ", =" + username + ", =" + password + |
| | | ", =" + protocolId + ", =" + sn + ", =" + belongId |
| | | ;
|
| | | return
|
| | | ",设备主键 =" + deviceId + ",设备所属公司 ="+ companyId + ",设备名称 =" + deviceName +
|
| | | ",设备类型:camera1, camera2, main_device ="+ type + ",设备地址 =" + installAddress + ",学校名称 =" + schoolName +
|
| | | ",品牌 =" + brandId + ",IP =" + ip + ",端口 =" + port +
|
| | | ",分辨率 =" + resolutionId + ",用户名 =" + username + ",密码 =" + password +
|
| | | ",通讯协议 =" + protocolId + ",序列号 =" + sn + ",所属设备id ="+ belongId +
|
| | | ",名称 =" + brandName + ",名称 =" + resolution + ",名称 =" + protocol
|
| | | ;
|
| | | }
|
| | | }
|
| | |
| | | import android.widget.Toast;
|
| | |
|
| | | import com.bsk.zhangbo.demoforbsk.R;
|
| | |
|
| | | import cn.com.basic.face.base.BaseApplication;
|
| | | import cn.com.basic.face.base.LeftRightBaseFragment;
|
| | | import cn.com.basic.face.base.MainActivity;
|
| | | import cn.com.basic.face.dialog.SelectDialog;
|
| | | import cn.com.basic.face.discern.common.CommonVariables;
|
| | | import cn.com.basic.face.discern.entity.Device;
|
| | | import cn.com.basic.face.discern.query.item.DeviceQueryItem;
|
| | | import cn.com.basic.face.service.DeviceMng;
|
| | | import cn.com.basic.face.util.Constant;
|
| | | import cn.com.basic.face.util.OkClickedListener;
|
| | |
| | | import com.lidroid.xutils.ViewUtils;
|
| | | import com.lidroid.xutils.view.annotation.ViewInject;
|
| | | import com.lidroid.xutils.view.annotation.event.OnClick;
|
| | |
|
| | | import org.xutils.http.RequestParams;
|
| | |
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | |
| | | private View schoolView;
|
| | | private View camera1View;
|
| | | private View camera2View;
|
| | |
|
| | | private DeviceQueryItem camera1;
|
| | | private DeviceQueryItem camera2;
|
| | |
|
| | | public void clearAll() {
|
| | | fragment_device_left_wifi_check_box.setChecked(false);
|
| | |
| | |
|
| | | @OnClick(R.id.fragment_device_right_camera1_save)
|
| | | public void fragment_device_right_camera1_save_click(View view) {
|
| | | Map<String, String> fields = new HashMap<>();
|
| | | fields.put("fragment_device_right_camera1_brand", fragment_device_right_camera1_brand.getText().toString());
|
| | | fields.put("fragment_device_right_camera1_ip", fragment_device_right_camera1_ip.getText().toString());
|
| | | fields.put("fragment_device_right_camera1_port", fragment_device_right_camera1_port.getText().toString());
|
| | | fields.put("fragment_device_right_camera1_resolution", fragment_device_right_camera1_resolution.getText().toString());
|
| | | fields.put("fragment_device_right_camera1_username", fragment_device_right_camera1_username.getText().toString());
|
| | | fields.put("fragment_device_right_camera1_password", fragment_device_right_camera1_password.getText().toString());
|
| | | DeviceMng.getInstance().saveCamera1Setting(fields);
|
| | | Toast.makeText(MainActivity.getInstance(), "保存成功", Toast.LENGTH_SHORT).show();
|
| | | RequestParams params = new RequestParams();
|
| | | Device camera1 = new Device();
|
| | | if (BaseApplication.getInstance().networkAvailable()) {
|
| | | params.addBodyParameter("brand", fragment_device_right_camera1_brand.getText().toString());
|
| | | params.addBodyParameter(Device.FieldNames.ip, fragment_device_right_camera1_ip.getText().toString());
|
| | | params.addBodyParameter(Device.FieldNames.port, fragment_device_right_camera1_port.getText().toString());
|
| | | params.addBodyParameter("resolution", fragment_device_right_camera1_resolution.getText().toString());
|
| | | params.addBodyParameter(Device.FieldNames.username, fragment_device_right_camera1_username.getText().toString());
|
| | | params.addBodyParameter(Device.FieldNames.password, fragment_device_right_camera1_password.getText().toString());
|
| | | params.addBodyParameter(Device.FieldNames.deviceId, camera1.getDeviceId());
|
| | |
|
| | | } else {
|
| | | camera1.setBrand(fragment_device_right_camera1_brand.getText().toString());
|
| | | camera1.setIp(fragment_device_right_camera1_ip.getText().toString());
|
| | | camera1.setPort(fragment_device_right_camera1_port.getText().toString());
|
| | | camera1.setResolution(fragment_device_right_camera1_resolution.getText().toString());
|
| | | camera1.setUsername(fragment_device_right_camera1_username.getText().toString());
|
| | | camera1.setPassword(fragment_device_right_camera1_password.getText().toString());
|
| | | camera1.setDeviceId(camera1.getDeviceId());
|
| | | }
|
| | | DeviceMng.getInstance().saveDevice(params, camera1);
|
| | | }
|
| | |
|
| | | @OnClick(R.id.fragment_device_right_camera2_save)
|
| | | public void fragment_device_right_camera2_save_click(View view) {
|
| | | Map<String, String> fields = new HashMap<>();
|
| | | fields.put("fragment_device_right_camera2_brand", fragment_device_right_camera2_brand.getText().toString());
|
| | | fields.put("fragment_device_right_camera2_ip", fragment_device_right_camera2_ip.getText().toString());
|
| | | fields.put("fragment_device_right_camera2_port", fragment_device_right_camera2_port.getText().toString());
|
| | | fields.put("fragment_device_right_camera2_resolution", fragment_device_right_camera2_resolution.getText().toString());
|
| | | fields.put("fragment_device_right_camera2_username", fragment_device_right_camera2_username.getText().toString());
|
| | | fields.put("fragment_device_right_camera2_password", fragment_device_right_camera2_password.getText().toString());
|
| | | DeviceMng.getInstance().saveCamera2Setting(fields);
|
| | | Toast.makeText(MainActivity.getInstance(), "保存成功", Toast.LENGTH_SHORT).show();
|
| | | RequestParams params = new RequestParams();
|
| | | Device camera2 = new Device();
|
| | | if (BaseApplication.getInstance().networkAvailable()) {
|
| | | params.addBodyParameter("brand", fragment_device_right_camera2_brand.getText().toString());
|
| | | params.addBodyParameter(Device.FieldNames.ip, fragment_device_right_camera2_ip.getText().toString());
|
| | | params.addBodyParameter(Device.FieldNames.port, fragment_device_right_camera2_port.getText().toString());
|
| | | params.addBodyParameter("resolution", fragment_device_right_camera2_resolution.getText().toString());
|
| | | params.addBodyParameter(Device.FieldNames.username, fragment_device_right_camera2_username.getText().toString());
|
| | | params.addBodyParameter(Device.FieldNames.password, fragment_device_right_camera2_password.getText().toString());
|
| | | params.addBodyParameter(Device.FieldNames.deviceId, camera2.getDeviceId());
|
| | |
|
| | | } else {
|
| | | camera2.setBrand(fragment_device_right_camera2_brand.getText().toString());
|
| | | camera2.setIp(fragment_device_right_camera2_ip.getText().toString());
|
| | | camera2.setPort(fragment_device_right_camera2_port.getText().toString());
|
| | | camera2.setResolution(fragment_device_right_camera2_resolution.getText().toString());
|
| | | camera2.setUsername(fragment_device_right_camera2_username.getText().toString());
|
| | | camera2.setPassword(fragment_device_right_camera2_password.getText().toString());
|
| | | camera2.setDeviceId(camera2.getDeviceId());
|
| | | }
|
| | | DeviceMng.getInstance().saveDevice(params, camera2);
|
| | | }
|
| | |
|
| | | @OnClick(R.id.fragment_device_right_camera1_brand_more)
|
| | |
| | |
|
| | | }
|
| | |
|
| | | public void setCamera1(Device camera1) {
|
| | |
|
| | | public void setCamera1(DeviceQueryItem camera1) {
|
| | | this.camera1 = camera1;
|
| | | fragment_device_right_camera1_ip.setText(camera1.getIp());
|
| | | fragment_device_right_camera1_username.setText(camera1.getUsername());
|
| | | fragment_device_right_camera1_password.setText(camera1.getPassword());
|
| | | fragment_device_right_camera1_port.setText(camera1.getPort());
|
| | | fragment_device_right_camera1_brand.setText(camera1.getBrandName());
|
| | | fragment_device_right_camera1_resolution.setText(camera1.getResolution());
|
| | | }
|
| | |
|
| | | public void setCamera2(Device camera2) {
|
| | |
|
| | | public void setCamera2(DeviceQueryItem camera2) {
|
| | | this.camera2 = camera2;
|
| | | fragment_device_right_camera2_ip.setText(camera2.getIp());
|
| | | fragment_device_right_camera2_username.setText(camera2.getUsername());
|
| | | fragment_device_right_camera2_password.setText(camera2.getPassword());
|
| | | fragment_device_right_camera2_port.setText(camera2.getPort());
|
| | | fragment_device_right_camera1_brand.setText(camera2.getBrandName());
|
| | | fragment_device_right_camera1_resolution.setText(camera2.getResolution());
|
| | | }
|
| | |
|
| | |
|
| | |
| | | c.set(2017, 4, 1, 12, 34, 56); |
| | | AlarmManager am = (AlarmManager) MainActivity.getInstance().getSystemService(Context.ALARM_SERVICE); |
| | | |
| | | am.setTime(c.getTimeInMillis()); |
| | | Process su = Runtime.getRuntime().exec("su"); |
| | | DataOutputStream outputStream = new DataOutputStream(su.getOutputStream()); |
| | | //am.setTime(c.getTimeInMillis()); |
| | | //Process su = Runtime.getRuntime().exec("su"); |
| | | //DataOutputStream outputStream = new DataOutputStream(su.getOutputStream()); |
| | | |
| | | //outputStream.writeBytes("busybox ifconfig wlan0 down\n"); |
| | | //outputStream.flush(); |
| | |
| | |
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import cn.com.basic.face.base.BaseApplication;
|
| | |
| | | try {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
| | | RequestParams params = new RequestParams(AppApi.BASE_URL +AppApi.Query.ATTENDANCE_DETAIL_QUERY);
|
| | | //params.addBodyParameter(AttendanceDetailQueryCondition.FieldNames.time, sdf.format(sdf.parse(item.getTime())));
|
| | | params.addBodyParameter(AttendanceDetailQueryCondition.FieldNames.time, sdf.format(new Date()));
|
| | | params.addBodyParameter(AttendanceDetailQueryCondition.FieldNames.registerId, item.getRegisterId());
|
| | | params.addBodyParameter(AttendanceDetailQueryCondition.FieldNames.deviceCompanyId, BaseApplication.getInstance().getAndroidDevice().getCompanyId());
|
| | | params.addBodyParameter(CommonVariables.Page.PAGE_SIZE, "20");
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void removeLastMonthData() {
|
| | | public void removeBeforeToday() {
|
| | | try {
|
| | | String sql = "delete from attendance where 1=1 and time< '" + DateUtil.getPreviousMonthLastDay() + "'";
|
| | | String sql = "delete from attendance where 1=1 and time< '" + DateUtil.getYesterday() + "'";
|
| | | MainActivity.getInstance().db.execSQL(sql);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | |
| | | import cn.com.basic.face.base.BaseApplication;
|
| | | import cn.com.basic.face.base.MainActivity;
|
| | | import cn.com.basic.face.discern.common.CommonVariables;
|
| | | import cn.com.basic.face.discern.query.item.DeviceQueryItem;
|
| | | import cn.com.basic.face.fragment.DeviceFragment;
|
| | | import cn.com.basic.face.service.sqlite.DeviceDao;
|
| | | import cn.com.basic.face.service.sync.DeleteLastMonthRecordAndPictureThread;
|
| | |
| | | params.addBodyParameter("deviceCompanyId", BaseApplication.getInstance().getAndroidDevice().getCompanyId());
|
| | | x.http().post(params, new BaseCommonCallBack() {
|
| | | public void success() {
|
| | | List<Device> devices = resultBean.getList(Device.class);
|
| | | List<DeviceQueryItem> devices = resultBean.getList(DeviceQueryItem.class);
|
| | | if (devices.size() > 0) {
|
| | | final Device camera1 = devices.get(0);
|
| | | final DeviceQueryItem camera1 = devices.get(0);
|
| | | BaseApplication.getInstance().setCamera1(camera1);
|
| | | DeviceFragment.getInstance().setCamera1(camera1);
|
| | | }
|
| | |
| | | params.addBodyParameter("deviceCompanyId", BaseApplication.getInstance().getAndroidDevice().getCompanyId());
|
| | | x.http().post(params, new BaseCommonCallBack() {
|
| | | public void success() {
|
| | | List<Device> devices = resultBean.getList(Device.class);
|
| | | List<DeviceQueryItem> devices = resultBean.getList(DeviceQueryItem.class);
|
| | | if (devices.size() > 0) {
|
| | | final Device camera2 = devices.get(0);
|
| | | final DeviceQueryItem camera2 = devices.get(0);
|
| | | BaseApplication.getInstance().setCamera2(camera2);
|
| | | DeviceFragment.getInstance().setCamera2(camera2);
|
| | | }
|
| | | }
|
| | | });
|
| | | } else {
|
| | | List<Device> camera1List = DeviceDao.getInstance().loadCamera(CommonVariables.DeviceType.CAMERA1, device.getBelongId());
|
| | | List<DeviceQueryItem> camera1List = DeviceDao.getInstance().loadCamera(CommonVariables.DeviceType.CAMERA1, device.getBelongId());
|
| | | if (camera1List != null && camera1List.size() > 0) {
|
| | | final Device camera1 = camera1List.get(0);
|
| | | final DeviceQueryItem camera1 = camera1List.get(0);
|
| | | BaseApplication.getInstance().setCamera1(camera1);
|
| | | DeviceFragment.getInstance().setCamera1(camera1);
|
| | | }
|
| | | List<Device> camera2List = DeviceDao.getInstance().loadCamera(CommonVariables.DeviceType.CAMERA2, device.getBelongId());
|
| | | List<DeviceQueryItem> camera2List = DeviceDao.getInstance().loadCamera(CommonVariables.DeviceType.CAMERA2, device.getBelongId());
|
| | | if (camera2List != null && camera2List.size() > 0) {
|
| | | final Device camera2 = camera2List.get(0);
|
| | | final DeviceQueryItem camera2 = camera2List.get(0);
|
| | | BaseApplication.getInstance().setCamera2(camera2);
|
| | | DeviceFragment.getInstance().setCamera2(camera2);
|
| | | }
|
| | |
| | | String password = "admin12345";
|
| | | String ip = "192.168.1.70";
|
| | | String port = "554";
|
| | |
|
| | | // SharedPreferences camera1 = DeviceMng.getInstance().loadSharedPreferences(CommonVariables.DeviceSharedPreferences.CAMERA1);
|
| | | // if (!"".equals(camera1.getString("fragment_device_right_camera1_username", ""))) {
|
| | | // username = camera1.getString("fragment_device_right_camera1_username", "");
|
| | | // }
|
| | | // if (!"".equals(camera1.getString("fragment_device_right_camera1_password", ""))) {
|
| | | // password = camera1.getString("fragment_device_right_camera1_password", "");
|
| | | // }
|
| | | // if (!"".equals(camera1.getString("fragment_device_right_camera1_ip", ""))) {
|
| | | // ip = camera1.getString("fragment_device_right_camera1_ip", "");
|
| | | // }
|
| | | // if (!"".equals(camera1.getString("fragment_device_right_camera1_port", ""))) {
|
| | | // port = camera1.getString("fragment_device_right_camera1_port", "");
|
| | | // }
|
| | |
|
| | | // return "rtsp://"+username+":"+password+"@"+ip+":"+port+"/h264/ch1/sub/av_stream";
|
| | | // return "rtsp://Admin:1234@192.168.1.22/h264";
|
| | | // return "rtsp://admin:a1234567@192.168.1.132:554/h264/ch1/sub/av_stream";
|
| | | return "rtsp://admin:admin12345@192.168.1.202:554/h264/ch1/main/av_stream";
|
| | | // return "rtsp://admin:a1234567@192.168.1.132:554/h264/ch1/main/av_stream";
|
| | | }
|
| | |
|
| | | public String getCamera1Address() {
|
| | |
| | | String password = "a1234567";
|
| | | String ip = "192.168.1.68";
|
| | | String port = "554";
|
| | |
|
| | | // SharedPreferences camera1 = DeviceMng.getInstance().loadSharedPreferences(CommonVariables.DeviceSharedPreferences.CAMERA2);
|
| | | // if (!"".equals(camera1.getString("fragment_device_right_camera1_username", ""))) {
|
| | | // username = camera1.getString("fragment_device_right_camera1_username", "");
|
| | | // }
|
| | | // if (!"".equals(camera1.getString("fragment_device_right_camera1_password", ""))) {
|
| | | // password = camera1.getString("fragment_device_right_camera1_password", "");
|
| | | // }
|
| | | // if (!"".equals(camera1.getString("fragment_device_right_camera1_ip", ""))) {
|
| | | // ip = camera1.getString("fragment_device_right_camera1_ip", "");
|
| | | // }
|
| | | // if (!"".equals(camera1.getString("fragment_device_right_camera1_port", ?
|
| | | // ""))) {
|
| | | // port = camera1.getString("fragment_device_right_camera1_port", "");
|
| | | // }
|
| | |
|
| | | //return "rtsp://"+username+":"+password+"@"+ip+":"+port+"/h264/ch1/sub/av_stream";
|
| | | // return "rtsp://admin:a1234567@192.168.1.68:554/h264/ch1/main/av_stream";
|
| | | // return "rtsp://admin:a1234567@192.168.1.69:554/h264/ch1/sub/av_stream";
|
| | | // return "rtsp://Admin:1234@192.168.1.22/h264";
|
| | | return "rtsp://admin:a1234567@192.168.1.201:554/h264/ch1/main/av_stream";
|
| | | }
|
| | |
|
| | |
|
| | | public void saveDevice(RequestParams params, Device camera) {
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | public void addPhoneCall(CheckInQueryItem visitor, CheckInQueryItem interviewee) {
|
| | | if (visitor == null) {
|
| | | Toast.makeText(MainActivity.getInstance(), "请先选择被访人", Toast.LENGTH_SHORT).show();
|
| | | Toast.makeText(MainActivity.getInstance(), "请先选择来访人", Toast.LENGTH_SHORT).show();
|
| | | return;
|
| | | }
|
| | | if (interviewee == null) {
|
| | |
| | | import android.database.Cursor;
|
| | | import android.database.sqlite.SQLiteDatabase;
|
| | |
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import cn.com.basic.face.base.BaseApplication;
|
| | |
| | | if(deviceId != null && !deviceId.trim().isEmpty()) {
|
| | | sb.append(" AND b.device_id=").append(deviceId);
|
| | | }
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
| | | sb.append(" AND a.time like '"+sdf.format(new Date())+"%' ");
|
| | | String deviceCompanyId = BaseApplication.getInstance().getAndroidDevice().getCompanyId();
|
| | | if(deviceCompanyId != null && !deviceCompanyId.trim().isEmpty()) {
|
| | | sb.append(" AND a.device_company_id = ").append(deviceCompanyId);
|
| | |
| | | sb.append(" ORDER BY a.time DESC");
|
| | | StringBuilder count = new StringBuilder(sb.length());
|
| | | count.append("select count(*) as count from (").append(sb).append(" ) _table");
|
| | | sb.append(" LIMIT ").append("0").append(",").append(100);
|
| | | AttendanceDetailQueryItem aqi = null;
|
| | | Cursor c = db.rawQuery(sb.toString(),new String[]{});
|
| | | Cursor c_count = db.rawQuery(count.toString(),new String[]{});
|
| | |
| | |
|
| | | import cn.com.basic.face.base.MainActivity;
|
| | | import cn.com.basic.face.discern.entity.Device;
|
| | | import cn.com.basic.face.discern.query.item.DeviceQueryItem;
|
| | |
|
| | | /**
|
| | | * 设备Dao
|
| | |
| | | * @param belongId 所属设备Id(主设备)
|
| | | * @return
|
| | | */
|
| | | public List<Device> loadCamera(String type, String belongId) {
|
| | | public List<DeviceQueryItem> loadCamera(String type, String belongId) {
|
| | |
|
| | | List<Device> list = new ArrayList<Device>();
|
| | | List<DeviceQueryItem> list = new ArrayList<DeviceQueryItem>();
|
| | |
|
| | |
|
| | | try {
|
| | |
| | | sb.append(" AND a.belong_id = ").append(belongId) ;
|
| | | }
|
| | |
|
| | | Device aqi = null;
|
| | | DeviceQueryItem aqi = null;
|
| | |
|
| | | Cursor c = MainActivity.getInstance().db.rawQuery(sb.toString(), new String[]{});
|
| | | while (c.moveToNext()) {
|
| | | aqi = new Device();
|
| | | aqi = new DeviceQueryItem();
|
| | | aqi.setDeviceId(c.getString(c.getColumnIndex("device_id")));
|
| | | aqi.setCompanyId(c.getString((c.getColumnIndex("company_id"))));
|
| | | aqi.setDeviceName(c.getString((c.getColumnIndex("device_name"))));
|
| | |
| | | while (true) {
|
| | | try {
|
| | | VisitMng.getInstance().removeLastMonthData();
|
| | | AttendanceMng.getInstance().removeLastMonthData();
|
| | | AttendanceMng.getInstance().removeBeforeToday();
|
| | | CheckInMng.getInstance().removeVisitorLastMonthData();
|
| | | SurveillanceMng.getInstance().removePhotoFileWhenStorageIsSlow();
|
| | | Thread.sleep(12*60*60*1000);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public static String getYesterday() {
|
| | | Calendar aCalendar = Calendar.getInstance();
|
| | | aCalendar.add(Calendar.DATE, -1);
|
| | |
|
| | | Date lastDateOfPreviousMonth = aCalendar.getTime();
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
| | | try {
|
| | | return sdf.format(lastDateOfPreviousMonth) + " 23:59:59";
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | return "";
|
| | | }
|
| | | }
|
| | |
|
| | | }
|