STFishFinder API  API version 0.0.0, Documentation version 3 -PRELIMINARY-
How To Connect to a Black Box Fish Finder

The following process assumes a suitable wrapper layer has been provided or written for your platform.

In order to connect to a compatible black box fish finder and perform all necessary initialization operations, the following steps must be performed in the order shown.

1. Open a connection to the hardware.
Within the wrapper layer or application program, open a connection to the hardware. The method for doing this will differ from one platform to another.
  • The FE2 wireless black box fish finder employs TCP/IP over a Wi-Fi link. If connecting to an FE2, opening a connection to the hardware would possibly involve turning on the Wi-Fi radio, followed by opening a socket to the FE2.

  • If the black box connects to the hardware via RS-232 or RS-485, the connection process is as follows:
    1. Open a COM: port at 115200 baud, 8 bits, no parity, 1 stop bit.
    2. Transmit a control-X (0x18) to the black box.
    3. Wait up to 2 seconds for a response, which should be "OK\r" (the ASCII characters 'O', 'K', followed by the carriage return code 0x13).
2. Create a STFishFinder class object.
Once the connection has been established, call CreateFishFinder() to create an instance (object) of the STFishFinder class.
3. Call Hello().

Before the created STFishFinder object can be used, it must be initialized by the black box. Prior to being initialized, the status of the API is FF_API_STATUS_NOT_INITIALIZED. This status may be confirmed by calling the GetApiStatus() member function, although this is not required.

To begin the initialization process, call the Hello() member function. This will send a message to the black box to initiate communication. It will also change the API status to FF_API_STATUS_INITIALIZING_PLEASE_WAIT.

4. Wait for uploading of state information from black box to complete.

Upon receiving the Hello message, the black box will begin uploading initial state information to the API. The state information being uploaded is the same for all devices that connect to the same black box.

The API receives this state information through a series of calls to ParseFFInputStream() These calls should occur within an event handler provided by the wrapper.

During the process of uploading the initial state information to the API, the wrapper and/or application program can poll the API status by recurring calls to GetApiStatus() . (See, however, the note below.)

When the process of uploading the initial state has completed, the API status changes to FF_API_STATUS_READY, and the API will then call the Callback_SettingChanged_t callback function, with its first argument containing the value FF_SETTING_TYPE_API_READY.

Note
Because the Callback_SettingChanged_t callback function is called at the completion of the uploading process, it is not necessary to poll the API status using GetApiStatus() . If the system designer prefers to poll rather than use the callback, however, this is an alternative method to determine that the uploading process is complete.
5. Call setters for Local Settings.

With the API status having reached FF_API_STATUS_READY, all other STFishFinder class member functions now become usable.

It is recommended that the application program now perform its own initialization of the API by calling the various setter functions for Local Settings. Many of the local settings are likely to be changed by the user (or by the application on behalf of the user), and it may be beneficial to save the user's settings in persistent storage (e.g. flash memory or hard drive) and restore these settings each time the application reconnects to the black box. The present step is the time to do this.

6. Call Control().
Call the Control() member function to begin receiving data messages on a periodic basis. The parameters to the Control() function specify which data messages the black box should transmit.
This completes the process of connecting to the black box fish finder and initializing the API and black box.
Note
If for some reason the connection is lost between the application program and the black box, then in order to re-establish the session, the entire process described above must be performed from the beginning.