Gocator API

- Home
- Types
- Files

All Classes Files Functions Variables Typedefs Macros Modules Pages
GoReceiver.h
Go to the documentation of this file.
1 /**
2 * @file GoReceiver.h
3 * @brief Declares the GoReceiver class.
4 *
5 * @internal
6 * Copyright (C) 2015 by LMI Technologies Inc.
7 * Licensed under the MIT License.
8 * Redistributed files must retain the above copyright notice.
9 */
10 #ifndef GO_SDK_RECEIVER_H
11 #define GO_SDK_RECEIVER_H
12
13 #include <GoSdk/GoSdkDef.h>
14 #include <kApi/Io/kNetwork.h>
15 #include <kApi/Io/kSerializer.h>
16 kBeginHeader()
17
18 /**
19 * @class GoReceiver
20 * @extends kObject
21 * @ingroup GoSdk-Internal
22 * @brief Represents a data/health receiver.
23 */
24 typedef kObject GoReceiver;
25
26 /** Defines the signature for a data message handler. */
27 typedef kStatus (kCall* GoReceiverMessageFx)(kPointer context, GoReceiver receiver, kSerializer reader);
28
29 /**
30 * Constructs a GoReceiver object.
31 *
32 * @public @memberof GoReceiver
33 * @version Introduced in firmware 4.0.10.27
34 * @param receiver Receives constructed receiver object.
35 * @param allocator Memory allocator (or kNULL for default)
36 * @return Operation status.
37 */
38 GoFx(kStatus) GoReceiver_Construct(GoReceiver* receiver, kAlloc allocator);
39
40 /**
41 * Sets the size of buffers used for receiving data.
42 *
43 * Call this function before calling GoReceiver_Open.
44 *
45 * @public @memberof GoReceiver
46 * @version Introduced in firmware 4.0.10.27
47 * @param receiver Receiver object.
48 * @param socketSize Size of the read buffer used by the underlying operating system socket (-1 to leave unchanged).
49 * @param clientSize Size of the read buffer used by the receiver object (-1 to leave unchanged).
50 * @return Operation status.
51 */
52 GoFx(kStatus) GoReceiver_SetBuffers(GoReceiver receiver, kSSize socketSize, kSSize clientSize);
53
54 /**
55 * Sets an I/O cancellation query handler for this receiver object.
56 *
57 * The I/O cancellation query handler will be polled periodically when I/O is blocked
58 * for a non-negligible amount of time. If the cancellation handler returns kERROR_ABORT,
59 * ongoing communication will be terminated.
60 *
61 * @public @memberof GoReceiver
62 * @version Introduced in firmware 4.0.10.27
63 * @param receiver Receiver object.
64 * @param function I/O cancellation callback function (or kNULL to unregister).
65 * @param context Context argument for callback (function receiver).
66 * @return Operation status.
67 */
68 GoFx(kStatus) GoReceiver_SetCancelHandler(GoReceiver receiver, kCallbackFx function, kPointer context);
69
70 /**
71 * Sets a callback function that can be used to receive notifications when data is available to be read.
72 *
73 * @public @memberof GoReceiver
74 * @version Introduced in firmware 4.0.10.27
75 * @param receiver Receiver object.
76 * @param function Data callback function (or kNULL to unregister).
77 * @param context Context argument for callback (function receiver).
78 * @return Operation status.
79 */
80 GoFx(kStatus) GoReceiver_SetMessageHandler(GoReceiver receiver, GoReceiverMessageFx function, kPointer context);
81
82 /**
83 * Opens a data connection to the specified sensor IP address and port.
84 *
85 * @public @memberof GoReceiver
86 * @version Introduced in firmware 4.0.10.27
87 * @param receiver Receiver object.
88 * @param address Sensor IP address.
89 * @param port Sensor data port.
90 * @return Operation status.
91 */
92 GoFx(kStatus) GoReceiver_Open(GoReceiver receiver, kIpAddress address, k32u port);
93
94 /**
95 * Closes the data connection.
96 *
97 * @public @memberof GoReceiver
98 * @version Introduced in firmware 4.0.10.27
99 * @param receiver Receiver object.
100 * @return Operation status.
101 */
102 GoFx(kStatus) GoReceiver_Close(GoReceiver receiver);
103
104 /**
105 * Reports whether the receiver object has been opened.
106 *
107 * @public @memberof GoReceiver
108 * @version Introduced in firmware 4.0.10.27
109 * @param receiver Receiver object.
110 * @return kTRUE if open; kFALSE otherwise.
111 */
112 GoFx(kBool) GoReceiver_IsOpen(GoReceiver receiver);
113
114 kEndHeader()
115 #include <GoSdk/Internal/GoReceiver.x.h>
116
117 #endif
GoReceiver::GoReceiver_SetCancelHandler
kStatus GoReceiver_SetCancelHandler(GoReceiver receiver, kCallbackFx function, kPointer context)
Sets an I/O cancellation query handler for this receiver object.
k32u
kPointer
GoReceiver::GoReceiver_Open
kStatus GoReceiver_Open(GoReceiver receiver, kIpAddress address, k32u port)
Opens a data connection to the specified sensor IP address and port.
kAlloc
GoReceiver::GoReceiver_IsOpen
kBool GoReceiver_IsOpen(GoReceiver receiver)
Reports whether the receiver object has been opened.
GoReceiver::GoReceiver_SetMessageHandler
kStatus GoReceiver_SetMessageHandler(GoReceiver receiver, GoReceiverMessageFx function, kPointer context)
Sets a callback function that can be used to receive notifications when data is available to be read...
kIpAddress
kSSize
GoReceiver::GoReceiver_SetBuffers
kStatus GoReceiver_SetBuffers(GoReceiver receiver, kSSize socketSize, kSSize clientSize)
Sets the size of buffers used for receiving data.
kSerializer
GoReceiverMessageFx
kStatus(kCall * GoReceiverMessageFx)(kPointer context, GoReceiver receiver, kSerializer reader)
Defines the signature for a data message handler.
Definition: GoReceiver.h:27
GoSdkDef.h
Essential SDK declarations.
GoReceiver
Represents a data/health receiver.
GoReceiver::GoReceiver_Close
kStatus GoReceiver_Close(GoReceiver receiver)
Closes the data connection.
kSerializer.h
kNetwork.h
kObject
kStatus
GoReceiver::GoReceiver_Construct
kStatus GoReceiver_Construct(GoReceiver *receiver, kAlloc allocator)
Constructs a GoReceiver object.
kBool