munnik / gosk

Go SignalK implementation
Apache License 2.0
4 stars 1 forks source link

Make SignalK http server #3

Open munnik opened 3 years ago

munnik commented 2 years ago

Example output on [http://localhost:3000/signalk]()

{
  "endpoints": {
    "v1": {
      "version": "1.41.3",
      "signalk-http": "http://localhost:3000/signalk/v1/api/",
      "signalk-ws": "ws://localhost:3000/signalk/v1/stream",
      "signalk-tcp": "tcp://localhost:8375"
    }
  },
  "server": {
    "id": "signalk-server-node",
    "version": "1.41.3"
  }
}

Example output on [http://localhost:3000/signalk/v1/api/]()

{
  "vessels": {
    "urn:mrn:imo:mmsi:244770688": {
      "mmsi": "244770688",
      "name": "LAMBERT",
      "environment": {
        "wind": {
          "speedApparent": {
            "meta": {
              "units": "m/s",
              "description": "Apparent wind speed"
            },
            "value": 0.6687779472015245,
            "$source": "wheelhouse.WI",
            "timestamp": "2022-03-14T13:22:19.946Z",
            "sentence": "MWV"
          },
          "angleApparent": {
            "meta": {
              "units": "rad",
              "description": "Apparent wind angle, negative to port"
            },
            "value": 1.9303341531464808,
            "$source": "wheelhouse.WI",
            "timestamp": "2022-03-14T13:22:19.946Z",
            "sentence": "MWV"
          }
        }
      },
      "navigation": {
        "rateOfTurn": {
          "meta": {
            "units": "rad/s",
            "description": "Rate of turn (+ve is change to starboard). If the value is AIS RIGHT or LEFT, set to +-0.0206 rads and add warning in notifications"
          },
          "value": 0.0007563093427035639,
          "$source": "wheelhouse.GP",
          "timestamp": "2022-03-14T13:22:20.164Z",
          "sentence": "ROT"
        },
        "speedOverGround": {
          "meta": {
            "units": "m/s",
            "description": "Vessel speed over ground. If converting from AIS 'HIGH' value, set to 102.2 (Ais max value) and add warning in notifications"
          },
          "value": 0.02777777777777778,
          "$source": "wheelhouse.GP",
          "timestamp": "2022-03-14T13:22:20.296Z",
          "sentence": "VTG",
          "values": {
            "wheelhouse.AI": {
              "value": 0,
              "sentence": "VDO",
              "timestamp": "2022-03-14T13:22:19.840Z"
            },
            "wheelhouse.GP": {
              "value": 0.02777777777777778,
              "timestamp": "2022-03-14T13:22:20.296Z",
              "sentence": "VTG"
            }
          }
        },
        "courseOverGroundTrue": {
          "meta": {
            "units": "rad",
            "description": "Course over ground (true)"
          },
          "value": 4.541346714726169,
          "$source": "wheelhouse.GP",
          "timestamp": "2022-03-14T13:22:20.296Z",
          "sentence": "VTG",
          "values": {
            "wheelhouse.AI": {
              "value": 4.511676117435491,
              "sentence": "VDO",
              "timestamp": "2022-03-14T13:22:19.840Z"
            },
            "wheelhouse.GP": {
              "value": 4.541346714726169,
              "timestamp": "2022-03-14T13:22:20.296Z",
              "sentence": "VTG"
            }
          }
        },
        "headingTrue": {
          "meta": {
            "units": "rad",
            "description": "The current true north heading of the vessel, equals 'headingMagnetic adjusted for magneticVariation'"
          },
          "value": 4.166100925461708,
          "$source": "wheelhouse.GP",
          "timestamp": "2022-03-14T13:22:20.310Z",
          "sentence": "HDT",
          "values": {
            "wheelhouse.AI": {
              "value": 4.171336913218887,
              "sentence": "VDO",
              "timestamp": "2022-03-14T13:22:19.840Z"
            },
            "wheelhouse.GP": {
              "value": 4.166100925461708,
              "timestamp": "2022-03-14T13:22:20.310Z",
              "sentence": "HDT"
            }
          }
        },
        "position": {
          "meta": {
            "description": "The position of the vessel in 2 or 3 dimensions (WGS84 datum)",
            "properties": {
              "longitude": {
                "type": "number",
                "description": "Longitude",
                "units": "deg",
                "example": 4.98765245
              },
              "latitude": {
                "type": "number",
                "description": "Latitude",
                "units": "deg",
                "example": 52.0987654
              },
              "altitude": {
                "type": "number",
                "description": "Altitude",
                "units": "m"
              }
            }
          },
          "value": {
            "longitude": 4.866811333333334,
            "latitude": 51.70018616666667
          },
          "$source": "wheelhouse.GP",
          "timestamp": "2022-03-14T13:22:20.000Z",
          "sentence": "GGA",
          "values": {
            "wheelhouse.AI": {
              "value": {
                "longitude": 4.86681,
                "latitude": 51.700185
              },
              "sentence": "VDO",
              "timestamp": "2022-03-14T13:22:19.840Z"
            },
            "wheelhouse.GP": {
              "value": {
                "longitude": 4.866811333333334,
                "latitude": 51.70018616666667
              },
              "timestamp": "2022-03-14T13:22:20.000Z",
              "sentence": "GGA"
            }
          }
        },
        "state": {
          "meta": {
            "description": "Current navigational state of the vessel"
          },
          "value": "moored",
          "$source": "wheelhouse.AI",
          "timestamp": "2022-03-14T13:22:19.840Z",
          "sentence": "VDO"
        },
        "specialManeuver": {
          "meta": {},
          "value": "not engaged",
          "$source": "wheelhouse.AI",
          "timestamp": "2022-03-14T13:22:19.840Z",
          "sentence": "VDO"
        },
        "magneticVariation": {
          "meta": {
            "units": "rad",
            "description": "The magnetic variation (declination) at the current position that must be added to the magnetic heading to derive the true heading. Easterly variations are positive and Westerly variations are negative (in Radians)."
          },
          "value": 0.00523598775717852,
          "$source": "wheelhouse.GP",
          "timestamp": "2022-03-14T13:22:20.000Z",
          "sentence": "RMC"
        },
        "magneticVariationAgeOfService": {
          "meta": {
            "units": "s",
            "description": "Seconds since the 1st Jan 1970 that the variation calculation was made"
          },
          "value": 1647264140,
          "$source": "wheelhouse.GP",
          "timestamp": "2022-03-14T13:22:20.000Z",
          "sentence": "RMC"
        },
        "datetime": {
          "meta": {
            "description": "Time and Date from the GNSS Positioning System"
          },
          "value": "2022-03-14T13:22:20.000Z",
          "$source": "wheelhouse.GP",
          "timestamp": "2022-03-14T13:22:20.000Z",
          "sentence": "RMC"
        },
        "gnss": {
          "methodQuality": {
            "meta": {
              "description": "Quality of the satellite fix"
            },
            "value": "GNSS Fix",
            "$source": "wheelhouse.GP",
            "timestamp": "2022-03-14T13:22:20.000Z",
            "sentence": "GGA"
          },
          "satellites": {
            "meta": {
              "description": "Number of satellites"
            },
            "value": 10,
            "$source": "wheelhouse.GP",
            "timestamp": "2022-03-14T13:22:20.000Z",
            "sentence": "GGA"
          },
          "antennaAltitude": {
            "meta": {
              "units": "m",
              "description": "Altitude of antenna"
            },
            "value": -1.4,
            "$source": "wheelhouse.GP",
            "timestamp": "2022-03-14T13:22:20.000Z",
            "sentence": "GGA"
          },
          "horizontalDilution": {
            "meta": {
              "description": "Horizontal Dilution of Precision"
            },
            "value": 0.7,
            "$source": "wheelhouse.GP",
            "timestamp": "2022-03-14T13:22:20.000Z",
            "sentence": "GGA"
          },
          "differentialAge": {
            "meta": {
              "units": "s",
              "description": "Age of DGPS data"
            },
            "value": 0,
            "$source": "wheelhouse.GP",
            "timestamp": "2022-03-14T13:22:20.000Z",
            "sentence": "GGA"
          },
          "differentialReference": {
            "meta": {
              "description": "ID of DGPS base station"
            },
            "value": 0,
            "$source": "wheelhouse.GP",
            "timestamp": "2022-03-14T13:22:20.000Z",
            "sentence": "GGA"
          },
          "satellitesInView": {
            "meta": {},
            "value": {
              "count": 7,
              "satellites": [
                {
                  "id": 67,
                  "elevation": 0.20943951028714078,
                  "azimuth": 5.148721294558878,
                  "SNR": 33
                },
                {
                  "id": 68,
                  "elevation": 0.24434609533499757,
                  "azimuth": 6.003932628231369,
                  "SNR": 49
                },
                {
                  "id": 76,
                  "elevation": 1.4311699869621286,
                  "azimuth": 6.2308254310424385,
                  "SNR": 52
                },
                {
                  "id": 77,
                  "elevation": 0.5410520682417803,
                  "azimuth": 5.4279739749417315,
                  "SNR": 40
                },
                {
                  "id": 85,
                  "elevation": 0.9075712112442766,
                  "azimuth": 0.8028514561007063,
                  "SNR": 51
                },
                {
                  "id": 86,
                  "elevation": 1.134464014055346,
                  "azimuth": 2.844886681400329,
                  "SNR": 41
                },
                {
                  "id": 87,
                  "elevation": 0.1396263401914272,
                  "azimuth": 3.455751919737823,
                  "SNR": 43
                }
              ]
            },
            "$source": "wheelhouse.GL",
            "timestamp": "2022-03-14T13:22:19.288Z",
            "sentence": "GSV",
            "values": {
              "wheelhouse.GP": {
                "value": {
                  "count": 10,
                  "satellites": [
                    {
                      "id": 2,
                      "elevation": 0.5410520682417803,
                      "azimuth": 0.9075712112442766,
                      "SNR": 46
                    },
                    {
                      "id": 12,
                      "elevation": 0.38397243552642474,
                      "azimuth": 1.6929693748210546,
                      "SNR": 45
                    },
                    {
                      "id": 18,
                      "elevation": 0.19198621776321237,
                      "azimuth": 3.019419606639613,
                      "SNR": 39
                    },
                    {
                      "id": 20,
                      "elevation": 0.1396263401914272,
                      "azimuth": 1.361356816866415,
                      "SNR": 35
                    },
                    {
                      "id": 22,
                      "elevation": 0.3665191430024964,
                      "azimuth": 4.293509960886386,
                      "SNR": 1
                    },
                    {
                      "id": 25,
                      "elevation": 1.0821041364835606,
                      "azimuth": 1.6929693748210546,
                      "SNR": 46
                    },
                    {
                      "id": 26,
                      "elevation": 0.40142572805035315,
                      "azimuth": 4.974188369319593,
                      "SNR": 45
                    },
                    {
                      "id": 29,
                      "elevation": 1.396263401914272,
                      "azimuth": 3.246312409450682,
                      "SNR": 49
                    },
                    {
                      "id": 31,
                      "elevation": 1.012290966387847,
                      "azimuth": 4.869468614176023,
                      "SNR": 48
                    },
                    {
                      "id": 32,
                      "elevation": 0.174532925239284,
                      "azimuth": 3.9968039879796033,
                      "SNR": 44
                    }
                  ]
                },
                "sentence": "GSV",
                "timestamp": "2022-03-14T13:22:19.234Z"
              },
              "wheelhouse.GL": {
                "value": {
                  "count": 7,
                  "satellites": [
                    {
                      "id": 67,
                      "elevation": 0.20943951028714078,
                      "azimuth": 5.148721294558878,
                      "SNR": 33
                    },
                    {
                      "id": 68,
                      "elevation": 0.24434609533499757,
                      "azimuth": 6.003932628231369,
                      "SNR": 49
                    },
                    {
                      "id": 76,
                      "elevation": 1.4311699869621286,
                      "azimuth": 6.2308254310424385,
                      "SNR": 52
                    },
                    {
                      "id": 77,
                      "elevation": 0.5410520682417803,
                      "azimuth": 5.4279739749417315,
                      "SNR": 40
                    },
                    {
                      "id": 85,
                      "elevation": 0.9075712112442766,
                      "azimuth": 0.8028514561007063,
                      "SNR": 51
                    },
                    {
                      "id": 86,
                      "elevation": 1.134464014055346,
                      "azimuth": 2.844886681400329,
                      "SNR": 41
                    },
                    {
                      "id": 87,
                      "elevation": 0.1396263401914272,
                      "azimuth": 3.455751919737823,
                      "SNR": 43
                    }
                  ]
                },
                "timestamp": "2022-03-14T13:22:19.288Z",
                "sentence": "GSV"
              }
            }
          }
        },
        "courseOverGroundMagnetic": {
          "meta": {
            "units": "rad",
            "description": "Course over ground (magnetic)"
          },
          "value": 4.536110726968991,
          "$source": "wheelhouse.GP",
          "timestamp": "2022-03-14T13:22:20.296Z",
          "sentence": "VTG"
        },
        "headingMagnetic": {
          "meta": {
            "units": "rad",
            "description": "Current magnetic heading of the vessel, equals 'headingCompass adjusted for magneticDeviation'"
          },
          "value": 4.16086493770453,
          "$source": "wheelhouse.GP",
          "timestamp": "2022-03-14T13:22:20.315Z",
          "sentence": "HDM"
        },
        "destination": {
          "commonName": {
            "meta": {
              "description": "Common name of the Destination, eg 'Fiji', also used in ais messages"
            },
            "value": "GEERTRUIDENBERG",
            "$source": "wheelhouse.AI",
            "timestamp": "2022-03-14T13:21:50.529Z",
            "sentence": "VDO"
          }
        }
      },
      "sensors": {
        "ais": {
          "class": {
            "meta": {
              "description": "AIS transponder class in sensors.ais.class, A or B"
            },
            "value": "A",
            "$source": "wheelhouse.AI",
            "timestamp": "2022-03-14T13:22:19.840Z",
            "sentence": "VDO"
          },
          "fromBow": {
            "meta": {
              "description": "The distance from the bow to the sensor location"
            },
            "value": 6,
            "$source": "wheelhouse.AI",
            "timestamp": "2022-03-14T13:21:50.529Z",
            "sentence": "VDO"
          },
          "fromCenter": {
            "meta": {
              "description": "The distance from the centerline to the sensor location, -ve to starboard, +ve to port"
            },
            "value": 0,
            "$source": "wheelhouse.AI",
            "timestamp": "2022-03-14T13:21:50.529Z",
            "sentence": "VDO"
          },
          "designatedAreaCode": {
            "meta": {},
            "value": 200,
            "$source": "wheelhouse.AI",
            "timestamp": "2022-03-14T13:21:51.576Z",
            "sentence": "VDO"
          },
          "functionalId": {
            "meta": {},
            "value": 10,
            "$source": "wheelhouse.AI",
            "timestamp": "2022-03-14T13:21:51.576Z",
            "sentence": "VDO"
          }
        }
      },
      "design": {
        "length": {
          "meta": {
            "description": "The various lengths of the vessel",
            "properties": {
              "overall": {
                "type": "number",
                "description": "Length overall",
                "units": "m"
              },
              "hull": {
                "type": "number",
                "description": "Length of hull",
                "units": "m"
              },
              "waterline": {
                "type": "number",
                "description": "Length at waterline",
                "units": "m"
              }
            }
          },
          "value": {
            "overall": 28
          },
          "$source": "wheelhouse.AI",
          "timestamp": "2022-03-14T13:21:51.576Z",
          "sentence": "VDO"
        },
        "beam": {
          "meta": {
            "units": "m",
            "description": "Beam length"
          },
          "value": 5.7,
          "$source": "wheelhouse.AI",
          "timestamp": "2022-03-14T13:21:51.576Z",
          "sentence": "VDO"
        },
        "draft": {
          "meta": {
            "description": "The draft of the vessel",
            "properties": {
              "minimum": {
                "description": "The minimum draft of the vessel",
                "type": "number",
                "units": "m"
              },
              "maximum": {
                "description": "The maximum draft of the vessel",
                "type": "number",
                "units": "m"
              },
              "current": {
                "description": "The current draft of the vessel",
                "type": "number",
                "units": "m"
              },
              "canoe": {
                "description": "The draft of the vessel without protrusions such as keel, centerboard, rudder",
                "type": "number",
                "units": "m"
              }
            }
          },
          "value": {
            "current": 2.05
          },
          "$source": "wheelhouse.AI",
          "timestamp": "2022-03-14T13:21:51.576Z",
          "sentence": "VDO"
        },
        "aisShipType": {
          "meta": {
            "description": "The ais ship type see http://www.bosunsmate.org/ais/message5.php",
            "properties": {
              "id": {
                "type": "number",
                "description": "The ship type number"
              },
              "name": {
                "type": "string",
                "description": "The ship type name"
              }
            }
          },
          "value": {
            "id": 52,
            "name": "Tug"
          },
          "$source": "wheelhouse.AI",
          "timestamp": "2022-03-14T13:21:50.529Z",
          "sentence": "VDO"
        }
      },
      "communication": {
        "callsignVhf": "PB7578"
      }
    }
  },
  "self": "vessels.urn:mrn:imo:mmsi:244770688",
  "version": "0.1.0",
  "sources": {
    "defaults": {},
    "wheelhouse": {
      "label": "wheelhouse",
      "type": "NMEA0183",
      "AI": {
        "talker": "AI",
        "sentences": {
          "VDM": "2022-03-14T13:22:20.092Z",
          "VDO": "2022-03-14T13:22:19.840Z"
        }
      },
      "WI": {
        "talker": "WI",
        "sentences": {
          "MWV": "2022-03-14T13:22:19.946Z"
        }
      },
      "GP": {
        "talker": "GP",
        "sentences": {
          "ROT": "2022-03-14T13:22:20.164Z",
          "RMC": "2022-03-14T13:22:20.000Z",
          "GGA": "2022-03-14T13:22:20.000Z",
          "VTG": "2022-03-14T13:22:20.296Z",
          "HDT": "2022-03-14T13:22:20.310Z",
          "HDM": "2022-03-14T13:22:20.315Z",
          "GSV": "2022-03-14T13:22:19.234Z"
        }
      },
      "GL": {
        "talker": "GL",
        "sentences": {
          "GSV": "2022-03-14T13:22:19.288Z"
        }
      }
    }
  }
}