1078-录音
This commit is contained in:
@@ -43,6 +43,7 @@ public class JT1078Template {
|
|||||||
private static final String H8801 = "8801";
|
private static final String H8801 = "8801";
|
||||||
private static final String H8802 = "8802";
|
private static final String H8802 = "8802";
|
||||||
private static final String H8803 = "8803";
|
private static final String H8803 = "8803";
|
||||||
|
private static final String H8804 = "8804";
|
||||||
private static final String H9101 = "9101";
|
private static final String H9101 = "9101";
|
||||||
private static final String H9102 = "9102";
|
private static final String H9102 = "9102";
|
||||||
private static final String H9201 = "9201";
|
private static final String H9201 = "9201";
|
||||||
@@ -606,4 +607,15 @@ public class JT1078Template {
|
|||||||
.build();
|
.build();
|
||||||
return SessionManager.INSTANCE.request(cmd, timeOut);
|
return SessionManager.INSTANCE.request(cmd, timeOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object record(String devId, J8804 j8804, int timeOut) {
|
||||||
|
Cmd cmd = new Cmd.Builder()
|
||||||
|
.setDevId(devId)
|
||||||
|
.setPackageNo(randomInt())
|
||||||
|
.setMsgId(H8804)
|
||||||
|
.setRespId(H0001)
|
||||||
|
.setRs(j8804)
|
||||||
|
.build();
|
||||||
|
return SessionManager.INSTANCE.request(cmd, timeOut);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -844,5 +844,53 @@ public class JT1078Controller {
|
|||||||
});
|
});
|
||||||
return deferredResult;
|
return deferredResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "1078-开始录音", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||||
|
@Parameter(name = "time", description = "录音时间,单位为秒(s) ,0 表示一直录音", required = false)
|
||||||
|
@Parameter(name = "save", description = "0:实时上传;1:保存", required = false)
|
||||||
|
@Parameter(name = "samplingRate", description = "音频采样率, 0:8K;1:11K;2:23K;3:32K", required = false)
|
||||||
|
@GetMapping("/record/start")
|
||||||
|
public void startRecord(HttpServletRequest request,
|
||||||
|
@Parameter(required = true) String deviceId,
|
||||||
|
@Parameter(required = false) Integer time,
|
||||||
|
@Parameter(required = false) Integer save,
|
||||||
|
@Parameter(required = false) Integer samplingRate
|
||||||
|
) {
|
||||||
|
if (ObjectUtils.isEmpty(time)) {
|
||||||
|
time = 0;
|
||||||
|
}
|
||||||
|
if (ObjectUtils.isEmpty(save)) {
|
||||||
|
save = 0;
|
||||||
|
}
|
||||||
|
if (ObjectUtils.isEmpty(samplingRate)) {
|
||||||
|
samplingRate = 0;
|
||||||
|
}
|
||||||
|
service.record(deviceId, 1, time, save, samplingRate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "1078-停止录音", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||||
|
@Parameter(name = "time", description = "录音时间,单位为秒(s) ,0 表示一直录音", required = false)
|
||||||
|
@Parameter(name = "save", description = "0:实时上传;1:保存", required = false)
|
||||||
|
@Parameter(name = "samplingRate", description = "音频采样率, 0:8K;1:11K;2:23K;3:32K", required = false)
|
||||||
|
@GetMapping("/record/stop")
|
||||||
|
public void stopRecord(HttpServletRequest request,
|
||||||
|
@Parameter(required = true) String deviceId,
|
||||||
|
@Parameter(required = false) Integer time,
|
||||||
|
@Parameter(required = false) Integer save,
|
||||||
|
@Parameter(required = false) Integer samplingRate
|
||||||
|
) {
|
||||||
|
if (ObjectUtils.isEmpty(time)) {
|
||||||
|
time = 0;
|
||||||
|
}
|
||||||
|
if (ObjectUtils.isEmpty(save)) {
|
||||||
|
save = 0;
|
||||||
|
}
|
||||||
|
if (ObjectUtils.isEmpty(samplingRate)) {
|
||||||
|
samplingRate = 0;
|
||||||
|
}
|
||||||
|
service.record(deviceId, 0, time, save, samplingRate);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,4 +102,5 @@ public interface Ijt1078Service {
|
|||||||
|
|
||||||
void uploadMediaData(String deviceId, JTQueryMediaDataCommand queryMediaDataCommand);
|
void uploadMediaData(String deviceId, JTQueryMediaDataCommand queryMediaDataCommand);
|
||||||
|
|
||||||
|
void record(String deviceId, int command, Integer time, Integer save, Integer samplingRate);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -726,4 +726,14 @@ public class jt1078ServiceImpl implements Ijt1078Service {
|
|||||||
j8803.setCommand(queryMediaDataCommand);
|
j8803.setCommand(queryMediaDataCommand);
|
||||||
jt1078Template.uploadMediaData(deviceId, j8803, 10);
|
jt1078Template.uploadMediaData(deviceId, j8803, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void record(String deviceId, int command, Integer time, Integer save, Integer samplingRate) {
|
||||||
|
J8804 j8804 = new J8804();
|
||||||
|
j8804.setCommond(command);
|
||||||
|
j8804.setDuration(time);
|
||||||
|
j8804.setSave(save);
|
||||||
|
j8804.setSamplingRate(samplingRate);
|
||||||
|
jt1078Template.record(deviceId, j8804, 10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user