GoFree Tier2 Toolkit (View Only)
GoFree Tier2 Toolkit (View Only)
GoFree Tier2 Toolkit (View Only)
Contents
1 Overview ........................................................................................................................................................................... 3
2 Service Discovery .............................................................................................................................................................. 3
2.1 UDP Multicast ............................................................................................................................................................ 3
2.2 Bonjour....................................................................................................................................................................... 3
3 Web Socket ....................................................................................................................................................................... 4
4 JSON .................................................................................................................................................................................. 4
5 Digital Data ........................................................................................................................................................................ 4
5.1 Requesting a list of data IDs - C2S.............................................................................................................................. 5
5.2 Send a list of data IDs - S2C ........................................................................................................................................ 5
5.3 Request full information about a data value - C2S .................................................................................................... 5
5.4 Send full information about a data value - S2C ......................................................................................................... 5
5.5 Requesting a value – C2S ........................................................................................................................................... 5
5.6 Unsubscribing – C2S ................................................................................................................................................... 6
5.7 Sending array of values – S2C .................................................................................................................................... 6
6 Settings.............................................................................................................................................................................. 6
6.1 Request a settings group - C2S................................................................................................................................... 6
6.2 Send a list of setting IDs - S2C .................................................................................................................................... 7
6.3 Request setting information - C2S ............................................................................................................................. 7
6.4 Send setting information - S2C .................................................................................................................................. 7
6.5 Request a list of settings - C2S ................................................................................................................................... 7
6.6 Unsubscribe from a list of settings............................................................................................................................. 8
6.7 Send a setting- S2C and C2S ....................................................................................................................................... 8
7 Events ................................................................................................................................................................................ 8
7.1 Register to receive an event - C2S ............................................................................................................................. 8
7.2 Unregister from an event – C2S ................................................................................................................................. 8
7.3 MOB Event – C2S and S2C.......................................................................................................................................... 8
7.4 Create a Waypoint – C2S and S2C.............................................................................................................................. 9
7.5 Activate/Silence/Acknowledge/Deactivate an alarm – C2S and S2C ........................................................................ 9
7.6 Reset a Trip Log .......................................................................................................................................................... 9
8 Vessels ............................................................................................................................................................................... 9
Page 1 of 31
GoFree Web Interface
Page 2 of 31
GoFree Web Interface
1 Overview
This document details the GoFree web interface provided by Navico Multifunctional Displays ( MFD ). The GoFree web
interface is designed to allow developers to create web pages and applications that use data from the Navico system.
Additionally the web interface can be used to change settings on the Navico system and control some functions.
The GoFree web interface is provided by an HTTP server and a WebSocket server.
The WebSocket server is used to bi-directionally send data between the Client (Web Browser, IPad App, PC
Application, etc) and a selected Navico device. The WebSocket data is encoded in simple JSON strings, which are very
easy to work with on the client side. The basic format of any data is:
{“ObjectType” : {OBJECT DATA} }
2 Service Discovery
2.1 UDP Multicast
Mobile devices wishing to connect can listen to multicast address 239.2.1.1, port 2052 to discover the IP address and
port of MFDs that support the data bridging function.
Any MFD will send the following JSON string to this multicast address:
{ “Name” : “Name”, “IP”: “N.N.N.N”, “Model” : “Model”, “Services” : [ { “Service” : “Service” , “Version”: N , “Port”: N }
]}
Where:
<Name> The friendly name of the MFD. If this is changed on the MFD the multicast will change to match.
<IP> IP Address of the MFD. This will be obtained from a DHCP server if one is available, otherwise it will be a
Zeroconfig address. Note that if a DHCP server is added to the network after power on the IP address announced will
switch from Zeroconfig to DHCP.
<Model> Model name of the MFD (e.g. "NSS-12").
<Service> Describes the type of data services that the MFD supports. For MFDs that support websockets, this will be
“navico-nav-ws”.
<Version> Version of the data protocol.
<Port> Port number used to transmit the data (e.g. 443).
MFDs will send this message at a rate of 1Hz. If this message is not received for a period of 2 second or longer, clients
should consider the MFD to be unavailable, and attempt to connect to a different MFD for data.
A code example is included in the appendices.
2.2 Bonjour
The server will be announced via the Bonjour protocol as a TCP service called “navico-nav-ws” on the port used to
transmit the data (e.g. 443). This is automatically supported in OS X and iOS, and can be added to Windows by
installing Bonjour for Windows:
Page 3 of 31
GoFree Web Interface
http://support.apple.com/kb/DL999
3 Web Socket
A WebSocket is a web technology which provides a bi-directional, full-duplex communication channel over a TCP
connection. The WebSocket API is being standardised by the WSC and the WebSocket protocol has been standardised
by the IETF as RFC 6455.
WebSockets have been designed to be implemented in web browsers and web servers. However they can be used by
a client or server application. They provide a standardised way for the server to send content to the browser without it
being requested by the client. This is therefore useful for sending live real-time data to a client as required in the
Navico system without the client being required to poll for the data.
As it is bi-directional it also provides a convenient way for the client to send commands to the server.
Communications are done over the regular TCP port number 443. The WebSocket protocol is currently supported in
several browsers including Safari, Firefox, Chrome and Internet Explorer 10. More information on browser support can
be found at http://en.wikipedia.org/wiki/WebSocket#Browser_support .
In an HTML file the standard client side scripting language is JavaScript.
Connecting to a WebSocket server is as simple as:
websocket = new WebSocket( WsUri );
The GoFree SDK includes a JavaScript library that contains basic functions for WebSocket control.
A complete function to obtain full WebSocket functionality can be found in Appendix A.
4 JSON
NOTES:
• JSON Basics: “{}” surrounds an object, “[]” surrounds an array.
• S2C = Server to Client
• C2S = Client to Server
5 Digital Data
Digital Data is any data available in the Navico system that can be displayed on the Info panel on a Navico MFD. This
includes data like boat speed, engine RPM and heading. It doesn’t include high bandwidth data such as radar or sonar
images.
The WebSocket client can get information about what digital data is available, information about an individual digital
data value and get an individual digital data value. It can also register to get digital data values in real time.
Each digital data value has a unique ID that is used in the JSON messages. These unique IDs are detailed in Section 11.
They can also be obtained from the server using some of the commanded detailed below.
This section details the JSON commands and responses used for digital data.
Page 4 of 31
GoFree Web Interface
group = The group of the data IDs being requested, in this case 1.
Data IDs, Format examples and unit information can be found in Section 11.
40 in the example above is the ID of the data requested. The client can request information about many data
values at the same time.
All of the values other than ID are optional, and more may be added.
Page 5 of 31
GoFree Web Interface
This example shows two pieces of data. IDs 1 and 2, Values 10.4 and 90 respectively:
id = The ID of the data
val = The value of the data in currently selected user units.
valStr = The value of the data as a correctly formatted string
sysVal = The value in system units. Standard system units can be found in section 11.3
inst = The data instance. This is an optional parameter that defaults to 0.
valid = is the data valid?
Note that there is no limit on the number of data values between [ and ].
Page 6 of 31
GoFree Web Interface
8 Vessels
Vessel information can be received through the WebSocket. A vessel can currently only be an AIS target. The client can
register to receive updates when a vessel of each type is changed.
This section details the JSON commands and responses used for vessels.
The elements of the array are vessel type IDs ( see section 14.1 ).
The elements of the array are vessel type IDs ( see section 14.1 ).
Page 7 of 31
GoFree Web Interface
{“Vessel”:[{“type”:1,“id”:40,“name”:“vessel name”,”lost”:false,”distance”:10.2,
“lat”:50.9892,“lon”:-
1.4975,”trueBearing”:18.3,”cpa”:1.54,”tcpa”:245.2,”sog”:3.8,”cog”:195.5,”relative
sog”:5.0,”relative cog”:210.1,”status”:2}]}
Page 8 of 31
GoFree Web Interface
namespace NavicoDiscovery
{
class Program
{
public class MFDService
{
public MFDService(string service, uint version, uint port)
{
Service = service;
Version = version;
Port = port;
}
string output;
while (true)
{
Page 9 of 31
GoFree Web Interface
string output;
while (true)
{
Byte[] data = client.Receive(ref localEp);
if (data.Length > 0)
{
string strData = Encoding.ASCII.GetString(data);
MFD deserializedMFD = JsonConvert.DeserializeObject<MFD>(strData);
Page 10 of 31
GoFree Web Interface
while (true) { }
}
}
}
11 Appendix B - Websocket
The code below is an example of how to connect to a WebSocket from a client using JavaScript. The functions that are
called within event handlers will need to be implemented elsewhere.
function initWebsocket(WsUri)
{
if ("WebSocket" in window)
{
try
{
if (typeof MozWebSocket == 'function')
{
WebSocket = MozWebSocket;
}
websocket = new WebSocket(WsUri);
Page 11 of 31
GoFree Web Interface
else
{
alert("I don't think this browser supports WebSockets");
}
}
}
There is currently a bug in Safari for IOS that causes what look like buffer overruns. To work around this issue it is
necessary to handle messages as below:
websocket. (evt) {
setTimeout(function() { handleMessage( evt.data );}, 0);
};
Page 12 of 31
GoFree Web Interface
12 Appendix C
12.1 Data Groups
Data Group ID
GPS 1
Navigation 2
Vessel 3
Sonar 4
Weather 5
Trip 6
Time 7
Engine 8
Transmission 9
Fuel Tank 10
Oil Tank 14
Engine Room 16
Cabin 17
Bait Well 18
Refrigerator 19
Heating System 20
Freezer 21
Page 13 of 31
GoFree Web Interface
Data Group ID
Battery 22
Rudder 23
Trim Tab 24
AC Input 25
Digital Switching 26
Other 27
GPS Status 28
Route Data 29
Speed Depth 30
Log Timer 31
Environment 32
Wind 33
Pilot 34
Sailing 35
AC Output 36
Charger 37
Inverter 38
Altitude 1 GPS
Page 14 of 31
GoFree Web Interface
COG 9 GPS
Bearing 14 Navigation
Course 15 Navigation
Destination 20 Navigation
Page 15 of 31
GoFree Web Interface
Odometer 29 Trip
Heading 37 Vessel
Voltage 38 Other
SOG 41 GPS
Page 16 of 31
GoFree Web Interface
Page 17 of 31
GoFree Web Interface
Depth 77 Sonar
Page 18 of 31
GoFree Web Interface
Page 19 of 31
GoFree Web Interface
Page 20 of 31
GoFree Web Interface
Page 21 of 31
GoFree Web Interface
Page 22 of 31
GoFree Web Interface
Page 23 of 31
GoFree Web Interface
Page 24 of 31
GoFree Web Interface
Page 25 of 31
GoFree Web Interface
Page 26 of 31
GoFree Web Interface
Page 27 of 31
GoFree Web Interface
Feet Depth
Celsius Temperature
Feet Altitude
Voltage Voltage
Gallons Volume
Amps Amps
Seconds Timer
Percent Percent
No units No units
Page 28 of 31
GoFree Web Interface
13 Appendix D
13.1 Setting Types
Setting Type ID
Enumeration
Boolean
Number
Display
Units
Alarms
Trip Log
Backlight Level
Night Mode
Page 29 of 31
GoFree Web Interface
14 Appendix E
14.1 Events
Activate Alarm
Deactivate Alarm
Acknowledge Alarm
Silence Alarm
MOB
Create Waypoint
Zoom In
Zoom Out
15 Appendix F
15.1 Vessel Types
Event Group ID
AIS 1
Dangerous 1
Safe 2
Acquiring 3
Acquiring Failed 4
Out of Range 5
Page 30 of 31
GoFree Web Interface
Event Group ID
Page 31 of 31