|
|
@@ -5,6 +5,7 @@ import (
|
|
|
"encoding/json"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
+ "sync"
|
|
|
"time"
|
|
|
|
|
|
"hnyfkj.com.cn/rtu/linux/baseapp"
|
|
|
@@ -14,6 +15,8 @@ import (
|
|
|
"hnyfkj.com.cn/rtu/linux/utils/jsonrpc2"
|
|
|
)
|
|
|
|
|
|
+var cameraMutex sync.Mutex
|
|
|
+
|
|
|
func getGigeCameraPower(ctx context.Context, req *jsonrpc2.Request) *jsonrpc2.Response {
|
|
|
on, err := camera.GetGigeCameraPowerCtrl()
|
|
|
if err != nil {
|
|
|
@@ -98,6 +101,8 @@ func getSupportedCameraCount(ctx context.Context, req *jsonrpc2.Request) *jsonrp
|
|
|
}
|
|
|
|
|
|
var count int
|
|
|
+ cameraMutex.Lock()
|
|
|
+ defer cameraMutex.Unlock()
|
|
|
|
|
|
switch strings.ToLower(cameraType) {
|
|
|
case "all":
|
|
|
@@ -166,6 +171,9 @@ func takePhoto(ctx context.Context, req *jsonrpc2.Request) *jsonrpc2.Response {
|
|
|
timeout = 300
|
|
|
}
|
|
|
|
|
|
+ cameraMutex.Lock()
|
|
|
+ defer cameraMutex.Unlock()
|
|
|
+
|
|
|
baseapp.Logger.Infof("开始拍照, 请稍微...")
|
|
|
var resp *jsonrpc2.Response
|
|
|
|