STFishFinder API  API version 0.0.0, Documentation version 3 -PRELIMINARY-
STFF-Callbacks.h
Go to the documentation of this file.
1 ///
2 /// @file STFF-Callbacks.h
3 ///
4 /// Header file containing type definitions for @link callbacks callback @endlink
5 /// functions used in the %STFishFinder API.
6 ///
7 /// @copyright
8 /// Copyright (c) 2012-2015 Sifferman Technology, LLC. All rights reserved.
9 ///
10 
11 #ifndef STFF_Callbacks_h_
12 #define STFF_Callbacks_h_
13 
14 #include "STFF-Types.h"
15 
16 
17 namespace STFF {
18 
19  // forward declaration
20  class STFishFinder;
21 
22  ////////////////////////////////////////////////////////////////////////
23  //
24  // CALLBACK TYPEDEFS
25  //
26  ////////////////////////////////////////////////////////////////////////
27  ////////////////////////////////////////////////////////////////////////
28  /// @defgroup callbacks Callbacks
29  /// @ingroup stff_member_functions
30  ///
31  /// Callbacks provide a facility for the API to call a function in the
32  /// wrapper layer or in the application when a certain event occurs.
33  /// Callback functions are platform- and application-dependent, and
34  /// must be written by users of the STFishFinder API.
35  ///
36  /// @see STFishFinder::SetCallbacks()
37  ////////////////////////////////////////////////////////////////////////
38 
39 
40  ////////////////////////////////////////////////////////////////////////
41  /// @typedef Callback_SettingChanged_t
42  ///
43  /// 'Setting Changed' callback.
44  ///
45  /// Type definition for a static callback function that is called by the
46  /// STFishFinder API when a setting is changed.
47  ///
48  /// This callback may be used to send a notification message to
49  /// the application to update any GUI elements that depend on
50  /// API settings.
51  /// For example, if the user changes the range,
52  /// the application will call function
53  /// @link STFishFinder::SetRange() SetRange() @endlink,
54  /// which will send
55  /// a Set Range command to the black box fish finder, and will also
56  /// call this callback to notify the application to update those
57  /// GUI elements that display the range.
58  ///
59  /// Usually, this callback is called twice each time a setting is
60  /// changed by a user. The first call is made immediately when one of
61  /// the API setter functions is called from the application. This
62  /// first call to the callback generally occurs concurrently with
63  /// sending the associated command to the black box fish finder.
64  ///
65  /// The second call to this callback occurs when a response message
66  /// is received from the black box fish finder, confirming the
67  /// setting change.
68  ///
69  /// These two calls to this callback can be used to provide a
70  /// more intuitive behavior in the application when the user
71  /// changes a setting. A recommended approach is to have the
72  /// callback function send a notification message to
73  /// a delegate for the GUI element(s) that are affected by the
74  /// changed setting. Upon receiving the message, the delegate
75  /// would call the getter member
76  /// function for the setting type specified in the first argument
77  /// of the callback function (e.g. GetRange() ), and then check
78  /// the <i>validated</i> flag in the response from the getter
79  /// function. If this is the first call to the callback after
80  /// a setting change, then the <i>validated</i> flag will be
81  /// @p false. Since the new setting has not been validated by
82  /// the black box, the delegate would change the GUI to display
83  /// the new value, but in a dimmed or grayed-out form.
84  ///
85  /// In the second call to the callback, the
86  /// <i>validated</i> flag will be @p true (with the setting value
87  /// having been adjusted to a legal value by the black box, if necessary).
88  /// In this case, the
89  /// new setting value can be shown in the GUI in its normal,
90  /// full-contrast form.
91  ///
92  /// This callback is also called when the API status changes from
93  /// ::FF_API_STATUS_INITIALIZING_PLEASE_WAIT to ::FF_API_STATUS_READY,
94  /// which occurs after calling the Hello() function and after the
95  /// uploading of the initial API state from the black box has completed.
96  ///
97  /// Below is a suggested C/C++ style declaration for this callback:
98  ///
99  /// @code
100  /// void OnSettingChanged (const STFishFinder *pFF,
101  /// FF_SettingType_t settingType,
102  /// FF_Frequency_t frequency);
103  /// @endcode
104  ///
105  /// @note Before creating any STFishFinder objects, it is
106  /// necessary to call STFishFinder::SetCallbacks()
107  /// to specify the addresses of this and all
108  /// other STFishFinder class callback functions.
109  ///
110  /// @param[in] const STFishFinder*
111  /// pointer to the STFishFinder object that initiated
112  /// the call to the callback;
113  /// serves as a 'this' pointer that can be used within
114  /// the callback function to provide object context.
115  ///
116  /// @param[in] ::FF_SettingType_t
117  /// the type of setting that has changed
118  ///
119  /// @param[in] ::FF_Frequency_t
120  /// the sonar frequency context for this setting change
121  /// (applies only to frequency-dependent settings)
122  ///
123  /// @returns void
124  ///
125  /// @see STFishFinder::SetCallbacks()
126  /// @see ::FF_SettingType_t
127  /// @see @ref setters
128  ///
129  /// @ingroup callbacks
130  ///
132 
133 
134  ////////////////////////////////////////////////////////////////////////
135  /// @typedef Callback_DataItemReceived_t
136  ///
137  /// 'Data Item Received' callback.
138  ///
139  /// Type definition for a static callback function that is called by the
140  /// STFishFinder API when a data item is received from the
141  /// black box.
142  ///
143  /// This callback is called upon receipt of the following kinds of
144  /// data from the black box:
145  /// - Depth
146  /// - Water Speed
147  /// - Water Temperature
148  /// - Battery Voltage
149  /// - Image Data
150  /// - Detected Fish
151  ///
152  /// This callback may be used to send a notification message to
153  /// the application to update GUI elements that display data
154  /// produced by the black box.
155  ///
156  /// Below is a suggested C/C++ style declaration for this callback:
157  ///
158  /// @code
159  /// void OnDataItemReceived (const STFishFinder *pFF,
160  /// FF_DataType_t dataType,
161  /// const void* pParam);
162  /// @endcode
163  ///
164  /// @note Before creating any STFishFinder objects, it is
165  /// necessary to call STFishFinder::SetCallbacks()
166  /// to specify the addresses of this and all
167  /// other STFishFinder class callback functions.
168  ///
169  /// @param[in] const STFishFinder*
170  /// pointer to the STFishFinder object that initiated
171  /// the call to the callback;
172  /// serves as a 'this' pointer that can be used within
173  /// the callback function to provide object context.
174  ///
175  /// @param[in] ::FF_DataType_t
176  /// the type of data that has been received
177  ///
178  /// @param[in] const void*
179  /// - For data type ::FF_DATA_TYPE_IMAGE:
180  /// Pointer to the ImageColumn object containing the image data
181  /// - For all other data types: Pointer to the originating STFishFinder object
182  ///
183  /// @returns void
184  ///
185  /// @see STFishFinder::SetCallbacks()
186  /// @see ::FF_DataType_t
187  ///
188  /// @ingroup callbacks
189  ///
190  typedef void (*Callback_DataItemReceived_t) (const STFishFinder*, FF_DataType_t, const void*);
191 
192 
193  ////////////////////////////////////////////////////////////////////////
194  /// @typedef Callback_DepthAlarmStateChange_t
195  ///
196  /// 'Depth Alarm State Change' callback.
197  ///
198  /// Type definition for a static callback function that is called by the
199  /// STFishFinder API when the shallow depth alarm or deep depth
200  /// alarm changes state. It is intended that this callback reside
201  /// in the wrapper layer.
202  ///
203  /// This callback may be used to send a notification message to
204  /// the application to play an alarm sound, or to terminate
205  /// the playing of an alarm sound indicating an active depth alarm.
206  /// It may also be used to send a notification message to cause
207  /// an alarm popup window to appear, or to cause some other visual
208  /// indication of the presence of an alarm condition.
209  ///
210  /// Below is a suggested C/C++ style declaration for this callback:
211  ///
212  /// @code{.cpp}
213  /// void OnDepthAlarmStateChange (const STFishFinder *pFF,
214  /// FF_DepthAlarmState_t depthAlarmState);
215  /// @endcode
216  ///
217  /// @note Before creating any STFishFinder objects, it is
218  /// necessary to call STFishFinder::SetCallbacks()
219  /// to specify the addresses of this and all
220  /// other STFishFinder class callback functions.
221  ///
222  /// @param[in] const STFishFinder*
223  /// pointer to the STFishFinder object that initiated
224  /// the call to the callback;
225  /// serves as a 'this' pointer that can be used within
226  /// the callback function to provide object context.
227  ///
228  /// @param[in] ::FF_DepthAlarmType_t
229  /// the type of depth alarm affected (shallow or deep)
230  ///
231  /// @returns void
232  ///
233  /// @see STFishFinder::SetCallbacks()
234  /// @see STFishFinder::GetDepthAlarmState()
235  /// @see STFishFinder::SilenceDepthAlarm()
236  /// @see @ref depth_alarms_how_to
237  ///
238  /// @ingroup callbacks
239  ///
240  typedef void (*Callback_DepthAlarmStateChange_t) (const STFishFinder*, FF_DepthAlarmType_t);
241 
242 
243  ////////////////////////////////////////////////////////////////////////
244  /// @typedef Callback_FishAlarmTrigger_t
245  ///
246  /// 'Fish Alarm Trigger' callback.
247  ///
248  /// Type definition for a static callback function that is called by the
249  /// STFishFinder API when a possible fish is detected.
250  /// It is intended that this callback reside in the wrapper layer.
251  ///
252  /// This callback may be used to send a notification message to
253  /// the application to play an alarm sound corresponding to the
254  /// detection of a possible fish target.
255  ///
256  /// Below is a suggested C/C++ style declaration for this callback:
257  ///
258  /// @code{.cpp}
259  /// void OnFishAlarmTrigger (const STFishFinder *pFF,
260  /// FF_FishData_t fishData);
261  /// @endcode
262  ///
263  /// @note Before creating any STFishFinder objects, it is
264  /// necessary to call STFishFinder::SetCallbacks()
265  /// to specify the addresses of this and all
266  /// other STFishFinder class callback functions.
267  ///
268  /// @param[in] const STFishFinder*
269  /// pointer to the STFishFinder object that initiated
270  /// the call to the callback;
271  /// serves as a 'this' pointer that can be used within
272  /// the callback function to provide object context.
273  ///
274  /// @param[in] ::FF_FishData_t
275  /// data structure providing information regarding the
276  /// detected target
277  ///
278  /// @returns void
279  ///
280  /// @see STFishFinder::SetCallbacks()
281  /// @see STFishFinder::SetFishAlarmSetting()
282  /// @see STFishFinder::GetFishAlarmSetting()
283  /// @see ::FF_FishAlarmSetting_t
284  ///
285  /// @ingroup callbacks
286  ///
287  typedef void (*Callback_FishAlarmTrigger_t) (const STFishFinder*, FF_FishData_t);
288 
289 
290  ////////////////////////////////////////////////////////////////////////
291  /// @typedef Callback_StreamDataToFF_t
292  ///
293  /// 'Stream Data to FishFinder' callback.
294  ///
295  /// Type definition for a static callback function that is called by the
296  /// STFishFinder API when it needs to send a message to the
297  /// black box fish finder.
298  ///
299  /// It is intended that this callback reside in the wrapper layer.
300  ///
301  /// Normally, this callback should simply invoke the necessary OS
302  /// library function to transmit a character string over the network
303  /// interface to the black box fish finder.
304  ///
305  /// Below is a suggested C/C++ style declaration for this callback:
306  ///
307  /// @code{.cpp}
308  /// void StreamDataToFF (const STFishFinder *pFF,
309  /// const char *pData,
310  /// uint32_t numChars);
311  /// @endcode
312  ///
313  /// @note Before creating any STFishFinder objects, it is
314  /// necessary to call STFishFinder::SetCallbacks()
315  /// to specify the addresses of this and all
316  /// other STFishFinder class callback functions.
317  ///
318  /// @param[in] const STFishFinder*
319  /// pointer to the STFishFinder object that initiated
320  /// the call to the callback;
321  /// serves as a 'this' pointer that can be used within
322  /// the callback function to provide object context.
323  ///
324  /// @param[in] const char*
325  /// pointer to character string containing message to be
326  /// transmitted
327  ///
328  /// @param[in] uint32_t
329  /// number of characters in the string
330  ///
331  /// @returns void
332  ///
333  /// @see STFishFinder::SetCallbackStreamDataToFF
334  ///
335  /// @ingroup callbacks
336  ///
337  typedef void (*Callback_StreamDataToFF_t) (const STFishFinder*, const char*, uint32_t);
338 
339 } // namespace STFF
340 
341 #endif // #defined (STFF_Callbacks_h_)
void(* Callback_SettingChanged_t)(const STFishFinder *, FF_SettingType_t, FF_Frequency_t)
'Setting Changed' callback.
void(* Callback_DepthAlarmStateChange_t)(const STFishFinder *, FF_DepthAlarmType_t)
'Depth Alarm State Change' callback.
Header file containing enumerations and simple struct types used in the STFishFinder API...
void(* Callback_StreamDataToFF_t)(const STFishFinder *, const char *, uint32_t)
'Stream Data to FishFinder' callback.
FF_DepthAlarmType_t
Depth Alarm Type selection.
Definition: STFF-Types.h:423
This is the namespace containing the platform-independent STFishFinder API.
Fish Data structure.
Definition: STFF-Types.h:614
void(* Callback_FishAlarmTrigger_t)(const STFishFinder *, FF_FishData_t)
'Fish Alarm Trigger' callback.
This is the main class for the STFishFinder API.
FF_DataType_t
Data Type options.
Definition: STFF-Types.h:210
FF_SettingType_t
Setting Type options.
Definition: STFF-Types.h:158
void(* Callback_DataItemReceived_t)(const STFishFinder *, FF_DataType_t, const void *)
'Data Item Received' callback.
FF_Frequency_t
Sonar Frequency options.
Definition: STFF-Types.h:77