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

com.qiniu.qvs.model.Device Maven / Gradle / Ivy

There is a newer version: 7.17.0
Show newest version
package com.qiniu.qvs.model;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.qiniu.util.StringMap;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;

@Builder
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Device {
    private int type; //可选项为摄像头、平台两类,1:摄像头,2:平台。
    private String name; // 设备名称 (可包含 字母、数字、中划线、下划线;1 ~ 100 个字符长)
    private String username; // 用户名, 4~40位,可包含大写字母、小写字母、数字、中划线,建议与设备国标ID一致
    private String password; // 密码, 4~40位,可包含大写字母、小写字母、数字、中划线
    private boolean pullIfRegister; // 注册成功后启动拉流, 默认关闭
    private String desc; // 关于设备的描述信息
    private String gbId; // 设备国标ID

    /**
     * 转换为POST参数对象
     *
     * @return POST参数对象
     */
    public StringMap transferPostParam() {
        Map paramMap = getStringObjectMap();
        StringMap result = new StringMap();
        result.putAll(paramMap);
        return result;
    }

    private Map getStringObjectMap() {
        Gson gson = new GsonBuilder().enableComplexMapKeySerialization().create();
        Map paramMap = gson.fromJson(gson.toJson(this), new TypeToken>() {
        }.getType());
        paramMap.put("type", type);
        paramMap.put("pullIfRegister", pullIfRegister);
        return paramMap;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy