itemir / signalk-activecaptain

SignalK plugin for receiving ActiveCaptain points of interest
1 stars 1 forks source link

Extending the plugin to function as a resources provider as per the resources API #2

Closed KvotheBloodless closed 2 weeks ago

KvotheBloodless commented 3 weeks ago

This is an extension that optionally enables the plugin to publish the ActiveCaptain POIs using the resources API. The result of this is that the data becomes easily consumable by other applications such as the Freeboard chartplotter.

Option 1 publishes the POIs as the built in "notes" resource type, and the result of this is that Freeboard (and other consumers) will see the POIs on the map and are able to query the data.

image

Option 2 publishes the raw POIs as custom resources according to their type directly from ActiveCaptain. This is illustrated here:

curl -XGET "localhost:3000/signalk/v2/api/resources/ac_Lock/68093" | jq
{
  "pointOfInterest": {
    "dateLastModified": "2014-08-07T11:34:21",
    "id": 68093,
    "mapLocation": {
      "latitude": 46.75516272316218,
      "longitude": 4.505402798320954
    },
    "name": "Lock #1 - Canal du Centre",
    "poiType": "Lock",
    "notes": [
      {
        "field": "PoiNotes",
        "value": "Pk 48.8\rVertical drop 2.34m"
      }
    ]
  }
}

IMPORTANT Due to the issue reported here with Freeboard, this plugin will cause trouble with existing functionality. DO NOT publish this update until the issue has been fixed in freeboard-sk.