海康工业相机对接黑白画面

This commit is contained in:
zc
2026-03-11 10:55:59 +08:00
parent 41e0b0b5b4
commit fde2f18ff5
5 changed files with 844 additions and 0 deletions

View File

@@ -1,17 +1,25 @@
package top.wms.admin.config.webSocket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import top.wms.admin.controller.hkMVS.CameraWebSocketHandler;
import top.wms.admin.controller.weighManage.ah.ScaleWebSocketHandler;
@Configuration
@EnableWebSocket
public class webSocket implements WebSocketConfigurer {
@Autowired
private CameraWebSocketHandler cameraWebSocketHandler;
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
// 注册WebSocket端点允许所有跨域请求
registry.addHandler(new ScaleWebSocketHandler(), "/ws/scale").setAllowedOrigins("*");
// 注册海康相机WebSocket端点
registry.addHandler(cameraWebSocketHandler, "/ws/camera").setAllowedOrigins("*");
}
}