Gocator API

- Home
- Topics
- 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) 2016-2022 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
17 /**
18 * @class GoReceiver
19 * @extends kObject
20 * @ingroup GoSdk-Internal
21 * @brief Represents a data/health receiver.
22 */
23 typedef kObject GoReceiver;
24
25 /** Defines the signature for a data message handler. */
26 typedef kStatus (kCall* GoReceiverMessageFx)(kPointer context, GoReceiver receiver, kSerializer reader);
27
28 /**
29 * Constructs a GoReceiver object.
30 *
31 * @public @memberof GoReceiver
32 * @version Introduced in firmware 4.0.10.27
33 * @param receiver Receives constructed receiver object.
34 * @param allocator Memory allocator (or kNULL for default)
35 * @return Operation status.
36 */
37 GoFx(kStatus) GoReceiver_Construct(GoReceiver* receiver, kAlloc allocator);
38
39 /**
40 * Sets the size of buffers used for receiving data.
41 *
42 * Call this function before calling GoReceiver_Open.
43 *
44 * @public @memberof GoReceiver
45 * @version Introduced in firmware 4.0.10.27
46 * @param receiver Receiver object.
47 * @param socketSize Size of the read buffer used by the underlying operating system socket (-1 to leave unchanged).
48 * @param clientSize Size of the read buffer used by the receiver object (-1 to leave unchanged).
49 * @return Operation status.
50 */
51 GoFx(kStatus) GoReceiver_SetBuffers(GoReceiver receiver, kSSize socketSize, kSSize clientSize);
52
53 /**
54 * Sets an I/O cancellation query handler for this receiver object.
55 *
56 * The I/O cancellation query handler will be polled periodically when I/O is blocked
57 * for a non-negligible amount of time. If the cancellation handler returns kERROR_ABORT,
58 * ongoing communication will be terminated.
59 *
60 * @public @memberof GoReceiver
61 * @version Introduced in firmware 4.0.10.27
62 * @param receiver Receiver object.
63 * @param function I/O cancellation callback function (or kNULL to unregister).
64 * @param context Context argument for callback (function receiver).
65 * @return Operation status.
66 */
67 GoFx(kStatus) GoReceiver_SetCancelHandler(GoReceiver receiver, kCallbackFx function, kPointer context);
68
69 /**
70 * Sets a callback function that can be used to receive notifications when data is available to be read.
71 *
72 * @public @memberof GoReceiver
73 * @version Introduced in firmware 4.0.10.27
74 * @param receiver Receiver object.
75 * @param function Data callback function (or kNULL to unregister).
76 * @param context Context argument for callback (function receiver).
77 * @return Operation status.
78 */
79 GoFx(kStatus) GoReceiver_SetMessageHandler(GoReceiver receiver, GoReceiverMessageFx function, kPointer context);
80
81 /**
82 * Opens a data connection to the specified sensor IP address and port.
83 *
84 * @public @memberof GoReceiver
85 * @version Introduced in firmware 4.0.10.27
86 * @param receiver Receiver object.
87 * @param address Sensor IP address.
88 * @param port Sensor data port.
89 * @return Operation status.
90 */
91 GoFx(kStatus) GoReceiver_Open(GoReceiver receiver, kIpAddress address, k32u port);
92
93 /**
94 * Closes the data connection.
95 *
96 * @public @memberof GoReceiver
97 * @version Introduced in firmware 4.0.10.27
98 * @param receiver Receiver object.
99 * @return Operation status.
100 */
101 GoFx(kStatus) GoReceiver_Close(GoReceiver receiver);
102
103 /**
104 * Reports whether the receiver object has been opened.
105 *
106 * @public @memberof GoReceiver
107 * @version Introduced in firmware 4.0.10.27
108 * @param receiver Receiver object.
109 * @return kTRUE if open; kFALSE otherwise.
110 */
111 GoFx(kBool) GoReceiver_IsOpen(GoReceiver receiver);
112
113 #include <GoSdk/Internal/GoReceiver.x.h>
114
115 #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:26
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