more readme, small state machine change and fixed wrong websocket close

This commit is contained in:
Timo Volkmann 2021-01-07 15:40:07 +01:00
parent e611b21d80
commit 9171452057
4 changed files with 18 additions and 6 deletions

View File

@ -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")

View File

@ -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

View File

@ -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;
};

View File

@ -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
}