manscdp deviceInfo

This commit is contained in:
shikong 2023-09-25 00:44:36 +08:00
parent f92c9a70f0
commit 76233345b5
2 changed files with 24 additions and 4 deletions

View File

@ -24,7 +24,7 @@ public class DeviceInfoResponseDTO {
private String deviceName; private String deviceName;
@Builder.Default @Builder.Default
private String Result = "OK"; private String result = "OK";
/** /**
* 设备生产商 * 设备生产商

View File

@ -5,6 +5,7 @@ import cn.skcks.docking.gb28181.sip.manscdp.catalog.query.CatalogItemDTO;
import cn.skcks.docking.gb28181.sip.manscdp.catalog.query.CatalogQueryDTO; import cn.skcks.docking.gb28181.sip.manscdp.catalog.query.CatalogQueryDTO;
import cn.skcks.docking.gb28181.sip.manscdp.catalog.response.CatalogResponseDTO; import cn.skcks.docking.gb28181.sip.manscdp.catalog.response.CatalogResponseDTO;
import cn.skcks.docking.gb28181.sip.manscdp.deviceinfo.request.DeviceInfoRequestDTO; import cn.skcks.docking.gb28181.sip.manscdp.deviceinfo.request.DeviceInfoRequestDTO;
import cn.skcks.docking.gb28181.sip.manscdp.deviceinfo.response.DeviceInfoResponseDTO;
import cn.skcks.docking.gb28181.sip.manscdp.keepalive.notify.KeepaliveNotifyDTO; import cn.skcks.docking.gb28181.sip.manscdp.keepalive.notify.KeepaliveNotifyDTO;
import cn.skcks.docking.gb28181.sip.utils.MANSCDPUtils; import cn.skcks.docking.gb28181.sip.utils.MANSCDPUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -19,6 +20,9 @@ public class MANSCDPTest {
public static final String deviceId = "44050100001110000010"; public static final String deviceId = "44050100001110000010";
public static final String channelId = "44050100001310000010"; public static final String channelId = "44050100001310000010";
public static final String deviceName = "模拟设备名称"; public static final String deviceName = "模拟设备名称";
public static final Integer channel = 1;
public static final String manufacturer = "gb28181-docking-platform";
public static String sn = String.valueOf(1); public static String sn = String.valueOf(1);
@Test @Test
@ -56,7 +60,7 @@ public class MANSCDPTest {
CatalogItemDTO catalogItemDTO = CatalogItemDTO.builder() CatalogItemDTO catalogItemDTO = CatalogItemDTO.builder()
.deviceId(channelId) .deviceId(channelId)
.name(deviceName) .name(deviceName)
.manufacturer("gb28181-docking-platform") .manufacturer(manufacturer)
.build(); .build();
List<CatalogItemDTO> itemDTOList = new ArrayList<>(2); List<CatalogItemDTO> itemDTOList = new ArrayList<>(2);
@ -93,7 +97,23 @@ public class MANSCDPTest {
.deviceId(deviceId) .deviceId(deviceId)
.sn(sn) .sn(sn)
.build(); .build();
MANSCDPUtils.XMLBuilder<DeviceInfoRequestDTO> xmlBuilder = MANSCDPUtils.build(deviceInfoRequestDTO); MANSCDPUtils.XMLBuilder<DeviceInfoRequestDTO> deviceInfoRequestDTOXMLBuilder = MANSCDPUtils.build(deviceInfoRequestDTO);
log.info("\n{}", MANSCDPUtils.toXml(xmlBuilder)); log.info("\n{}", MANSCDPUtils.toXml(deviceInfoRequestDTOXMLBuilder));
DeviceInfoResponseDTO deviceInfoResponseDTO = DeviceInfoResponseDTO.builder()
.deviceId(deviceId)
.channel(channel)
.deviceName(deviceName)
.manufacturer(manufacturer)
.build();
MANSCDPUtils.XMLBuilder<DeviceInfoResponseDTO> deviceInfoResponseDTOXMLBuilder = MANSCDPUtils.build(deviceInfoResponseDTO);
String xml = MANSCDPUtils.toXml(deviceInfoResponseDTOXMLBuilder);
log.info("\n{}", xml);
DeviceInfoResponseDTO parse = MANSCDPUtils.parse(xml, DeviceInfoResponseDTO.class);
if (parse != null) {
log.info("getDeviceName {}", parse.getDeviceName());
}
} }
} }