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

io.github.lunasaw.gb28181.common.entity.notify.DeviceAlarmNotify Maven / Gradle / Ivy

The newest version!
package io.github.lunasaw.gb28181.common.entity.notify;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

import com.luna.common.date.DateUtils;
import io.github.lunasaw.gb28181.common.entity.response.DeviceItem;
import io.github.lunasaw.gb28181.common.entity.DeviceAlarm;
import io.github.lunasaw.gb28181.common.entity.xml.XmlBean;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * 
 * 
 * Alarm
 * 744523
 * 2133
 * AlarmPriority
 * deviceAlarm.getAlarmMethod()
 * DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(deviceAlarm.getAlarmTime())
 * deviceAlarm.getAlarmDescription() 
 * deviceAlarm.getLongitude()
 * deviceAlarm.getLatitude() 
 * 
 * deviceAlarm.getAlarmType() 
 * 
 * 
 * 
 * @author luna
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@XmlRootElement(name = "Notify")
@XmlAccessorType(XmlAccessType.FIELD)
public class DeviceAlarmNotify extends XmlBean {
    @XmlElement(name = "CmdType")
    public String     cmdType;

    @XmlElement(name = "SN")
    public String     sn;

    @XmlElement(name = "DeviceID")
    public String     deviceId;

    @XmlElement(name = "AlarmPriority")
    public String     alarmPriority;

    @XmlElement(name = "AlarmMethod")
    public String     alarmMethod;

    /**
     * ISO8601
     */
    @XmlElement(name = "AlarmTime")
    public String     alarmTime;

    /**
     * 经度
     */
    @XmlElement(name = "Longitude")
    public String     longitude;

    /**
     * 纬度
     */
    @XmlElement(name = "Latitude")
    public String     latitude;

    @XmlElement(name = "Info")
    private AlarmInfo info;

    public DeviceAlarmNotify(String cmdType, String sn, String deviceId) {
        this.cmdType = cmdType;
        this.sn = sn;
        this.deviceId = deviceId;
    }

    public static void main(String[] args) {
        DeviceAlarmNotify deviceCatalog = new DeviceAlarmNotify();
        deviceCatalog.setDeviceId("123");
        DeviceItem deviceItem = new DeviceItem();
        deviceItem.setAddress("!23");
        System.out.println(deviceCatalog);
    }

    public DeviceAlarmNotify setAlarm(DeviceAlarm deviceAlarm) {
        setAlarmPriority(deviceAlarm.getAlarmPriority());
        setAlarmMethod(deviceAlarm.getAlarmMethod());
        setAlarmTime(DateUtils.formatTime(DateUtils.ISO8601_PATTERN, deviceAlarm.getAlarmTime()));
        setLongitude(String.valueOf(deviceAlarm.getLongitude()));
        setLatitude(String.valueOf(deviceAlarm.getLatitude()));
        setInfo(new AlarmInfo(deviceAlarm.getAlarmType()));
        return this;
    }

    @Getter
    @Setter
    @AllArgsConstructor
    @NoArgsConstructor
    @XmlRootElement(name = "Info")
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class AlarmInfo {

        @XmlElement(name = "AlarmType")
        public String alarmType;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy