All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.lkqm.hcnet.handler.AbstractHandler Maven / Gradle / Ivy

There is a newer version: 0.0.5
Show newest version
package com.github.lkqm.hcnet.handler;

import com.github.lkqm.hcnet.HCNetSDK.NET_DVR_ALARMER;
import com.github.lkqm.hcnet.model.DeviceInfo;

public abstract class AbstractHandler implements Handler {

    // 解析设备信息
    protected DeviceInfo resolveDeviceInfo(NET_DVR_ALARMER alarm) {
        DeviceInfo deviceInfo = new DeviceInfo();
        if (alarm.byUserIDValid == 1) {
            deviceInfo.setUserId(alarm.lUserID.longValue());
        }
        if (alarm.byDeviceIPValid == 1) {
            String deviceIp = new String(alarm.sDeviceIP).trim();
            deviceInfo.setDeviceIp(deviceIp);
        }
        if (alarm.byDeviceNameValid == 1) {
            String deviceName = new String(alarm.sDeviceName).trim();
            deviceInfo.setDeviceIp(deviceName);
        }
        if (alarm.bySerialValid == 1) {
            String serialNumber = new String(alarm.sSerialNumber).trim();
            deviceInfo.setSerialNumber(serialNumber);
        }
        if (alarm.byMacAddrValid == 1) {
            String macAddr = new String(alarm.byMacAddr).trim();
            deviceInfo.setDeviceMacAddr(macAddr);
        }
        return deviceInfo;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy