diff --git a/core/service.go b/core/service.go index ba6446e..55faf13 100644 --- a/core/service.go +++ b/core/service.go @@ -99,7 +99,7 @@ func (t *TrackingService) IsRecording() bool { } // creates a new Pipeline with requested collectors -func (t *TrackingService) StartPipeline(cols ...CollectorType) (string, error) { +func (t *TrackingService) StartLivetracking(cols ...CollectorType) (string, error) { logrus.Info("SERVICE: NEW PIPELINE") // check if state machine is in right state if t.opMode == RECORDING { @@ -107,6 +107,11 @@ func (t *TrackingService) StartPipeline(cols ...CollectorType) (string, error) { logrus.Warn(txt) return "RECORDING", errors.New(txt) } + if t.opMode == REPLAY { + txt := "trackingservice: please stop Replay before resetting pipeline" + logrus.Warn(txt) + return "RECORDING", errors.New(txt) + } if t.opMode == LIVE { txt := "trackingservice: stop tracking running stream before creating new one" logrus.Warnln(txt) @@ -215,7 +220,12 @@ func (t *TrackingService) StopAll() (*TrackingMetadata, error) { // retrieves tracking with all data and starts replay pipeline if desired. // in that case the application behaves like in live mode. func (t *TrackingService) LoadTracking(trackingId uuid.UUID, replay bool) (*Tracking, error) { - if !(t.opMode == REPLAY || t.opMode == STOPPED || t.opMode == LIVE || t.opMode == RECORDING) { + if t.opMode == RECORDING { + txt := "trackingservice: please stop recording before load another tracking" + logrus.Warn(txt) + return nil, errors.New(txt) + } + if t.opMode == REPLAY || t.opMode == STOPPED || t.opMode == LIVE { t.StopAll() } logrus.Info("LOAD TRACKING from database") diff --git a/readme.md b/readme.md index d8205b7..0c03bd7 100644 --- a/readme.md +++ b/readme.md @@ -1,9 +1,11 @@ # gyropsc ⚡ **Realtime Location Dashboard 🚀** ## Quickstart +First copy `example_config.yml` to `gpsconfig.yml` and adjust your parameters. if you intend to use this tool with ublox over USB or Serial, you need to set the name of your port in this config file. otherwise the program will panic. ### Requirements * Win, Linux or Mac Computer, ideally with serial port and WiFi -* +* download latest Release and unzip it +* execute `gyropgsc-$OS`, according to your operating system ## Build from source ### Requirements diff --git a/static/scripts/websocket.js b/static/scripts/websocket.js index ca85e42..cd32146 100644 --- a/static/scripts/websocket.js +++ b/static/scripts/websocket.js @@ -199,7 +199,7 @@ window.addEventListener("load", function(evt) { checkBoxSmartphone.disabled = false; checkBoxUblox.disabled = false; document.getElementById("tracking state").innerHTML = "Tracking state: PIPELINE CLOSED" - ws.close(); + //ws.close(); } return false; }; diff --git a/web/http.go b/web/http.go index 29dc37d..f4b2226 100644 --- a/web/http.go +++ b/web/http.go @@ -108,7 +108,7 @@ func startPipelineHandler(s *core.TrackingService, c *core.Configuration) fiber. if tcp == "true" { collecs = append(collecs, core.TCP) } - res, err := s.StartPipeline(collecs...) + res, err := s.StartLivetracking(collecs...) prepres := make(map[string]interface{}) prepres["tracking_state"] = res @@ -209,7 +209,7 @@ func createFiberWebsocketHandler(s core.Subscriber) func(conn *websocket.Conn) { logrus.Traceln("write to ws:", cmsg) err := c.WriteMessage(websocket.TextMessage, []byte(cmsg)) if err != nil { - logrus.Info("close websocket connection") + logrus.Infoln("close websocket connection", err) c.Close() break }