|
|
@ -1,12 +1,22 @@ |
|
|
|
package com.iflytop.digester.controller; |
|
|
|
import com.iflytop.digester.deviceinstance.Device; |
|
|
|
import com.iflytop.digester.underframework.UfCmdSnippetExecutor; |
|
|
|
import com.iflytop.digester.underframework.controller.UfApiControllerBase; |
|
|
|
import com.iflytop.digester.underframework.controller.UfApiResponse; |
|
|
|
import com.iflytop.digester.underframework.dao.model.UfMdbNotification; |
|
|
|
import jakarta.annotation.Resource; |
|
|
|
import org.opencv.core.Core; |
|
|
|
import org.opencv.core.Mat; |
|
|
|
import org.opencv.core.MatOfByte; |
|
|
|
import org.opencv.core.Rect; |
|
|
|
import org.opencv.imgcodecs.Imgcodecs; |
|
|
|
import org.springframework.http.MediaType; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
|
|
|
|
import java.util.Base64; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
@Controller |
|
|
@ -40,4 +50,14 @@ public class TestController extends UfApiControllerBase { |
|
|
|
this.device.liquidAddition.addLiquidToTubes(tubes, type, volume); |
|
|
|
return this.success(); |
|
|
|
} |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
@PostMapping(value="/api/test/take-shot", produces= MediaType.IMAGE_JPEG_VALUE) |
|
|
|
public byte[] takeShot() { |
|
|
|
this.device.camera.enable(); |
|
|
|
var srcImageMat = this.device.camera.grabToMat(); |
|
|
|
MatOfByte imageMob = new MatOfByte(); |
|
|
|
Imgcodecs.imencode(".png", srcImageMat, imageMob); |
|
|
|
return imageMob.toArray(); |
|
|
|
} |
|
|
|
} |