| | |
| | | @Override
|
| | | public boolean deviceStatusQuery(Device device, SipSubscribe.Event errorEvent) {
|
| | | try {
|
| | | String charset = device.getCharset();
|
| | | StringBuffer catalogXml = new StringBuffer(200);
|
| | | catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
|
| | | catalogXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
|
| | | catalogXml.append("<Query>\r\n");
|
| | | catalogXml.append("<CmdType>DeviceStatus</CmdType>\r\n");
|
| | | catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
|
| | |
| | | public boolean deviceInfoQuery(Device device) {
|
| | | try {
|
| | | StringBuffer catalogXml = new StringBuffer(200);
|
| | | catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
|
| | | String charset = device.getCharset();
|
| | | catalogXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
|
| | | catalogXml.append("<Query>\r\n");
|
| | | catalogXml.append("<CmdType>DeviceInfo</CmdType>\r\n");
|
| | | catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
|
| | |
| | | public boolean catalogQuery(Device device, SipSubscribe.Event errorEvent) {
|
| | | try {
|
| | | StringBuffer catalogXml = new StringBuffer(200);
|
| | | catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
|
| | | String charset = device.getCharset();
|
| | | catalogXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
|
| | | catalogXml.append("<Query>\r\n");
|
| | | catalogXml.append("<CmdType>Catalog</CmdType>\r\n");
|
| | | catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
|
| | |
| | | }
|
| | | try {
|
| | | StringBuffer recordInfoXml = new StringBuffer(200);
|
| | | recordInfoXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
|
| | | String charset = device.getCharset();
|
| | | recordInfoXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
|
| | | recordInfoXml.append("<Query>\r\n");
|
| | | recordInfoXml.append("<CmdType>RecordInfo</CmdType>\r\n");
|
| | | recordInfoXml.append("<SN>" + sn + "</SN>\r\n");
|
| | |
| | | public boolean mobilePostitionQuery(Device device, SipSubscribe.Event errorEvent) {
|
| | | try {
|
| | | StringBuffer mobilePostitionXml = new StringBuffer(200);
|
| | | mobilePostitionXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
|
| | | String charset = device.getCharset();
|
| | | mobilePostitionXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
|
| | | mobilePostitionXml.append("<Query>\r\n");
|
| | | mobilePostitionXml.append("<CmdType>MobilePosition</CmdType>\r\n");
|
| | | mobilePostitionXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
|
| | |
| | | public boolean mobilePositionSubscribe(Device device, int expires, int interval) {
|
| | | try {
|
| | | StringBuffer subscribePostitionXml = new StringBuffer(200);
|
| | | subscribePostitionXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
|
| | | String charset = device.getCharset();
|
| | | subscribePostitionXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
|
| | | subscribePostitionXml.append("<Query>\r\n");
|
| | | subscribePostitionXml.append("<CmdType>MobilePosition</CmdType>\r\n");
|
| | | subscribePostitionXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
|
| | |
| | | public boolean alarmSubscribe(Device device, int expires, String startPriority, String endPriority, String alarmMethod, String alarmType, String startTime, String endTime) {
|
| | | try {
|
| | | StringBuffer cmdXml = new StringBuffer(200);
|
| | | cmdXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
|
| | | String charset = device.getCharset();
|
| | | cmdXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
|
| | | cmdXml.append("<Query>\r\n");
|
| | | cmdXml.append("<CmdType>Alarm</CmdType>\r\n");
|
| | | cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
|
| | |
| | | public boolean catalogSubscribe(Device device, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) {
|
| | | try {
|
| | | StringBuffer cmdXml = new StringBuffer(200);
|
| | | cmdXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n");
|
| | | String charset = device.getCharset();
|
| | | cmdXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n");
|
| | | cmdXml.append("<Query>\r\n");
|
| | | cmdXml.append("<CmdType>Catalog</CmdType>\r\n");
|
| | | cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n");
|
| | |
| | | content.append("PAUSE RTSP/1.0\r\n");
|
| | | content.append("CSeq: " + cseq + "\r\n");
|
| | | content.append("PauseTime: now\r\n");
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
|
| | | if (request == null) {
|
| | | return;
|
| | | }
|
| | |
| | | content.append("PLAY RTSP/1.0\r\n");
|
| | | content.append("CSeq: " + cseq + "\r\n");
|
| | | content.append("Range: npt=now-\r\n");
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
|
| | | if (request == null) return;
|
| | | logger.info(request.toString());
|
| | | ClientTransaction clientTransaction = null;
|
| | |
| | | content.append("CSeq: " + cseq + "\r\n");
|
| | | content.append("Range: npt=" + Math.abs(seekTime) + "-\r\n");
|
| | |
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
|
| | | if (request == null) return;
|
| | | logger.info(request.toString());
|
| | | ClientTransaction clientTransaction = null;
|
| | |
| | | content.append("PLAY RTSP/1.0\r\n");
|
| | | content.append("CSeq: " + cseq + "\r\n");
|
| | | content.append("Scale: " + String.format("%.1f",speed) + "\r\n");
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString(), cseq);
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
|
| | | if (request == null) return;
|
| | | logger.info(request.toString());
|
| | | ClientTransaction clientTransaction = null;
|