Gocator API

- Home
- Categories
- Types
- Files

All Classes Files Functions Variables Typedefs Macros Groups 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) 2014 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 * @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 * @param receiver Receiver object.
46 * @param socketSize Size of the read buffer used by the underlying operating system socket (-1 to leave unchanged).
47 * @param clientSize Size of the read buffer used by the receiver object (-1 to leave unchanged).
48 * @return Operation status.
49 */
50 GoFx(kStatus) GoReceiver_SetBuffers(GoReceiver receiver, kSSize socketSize, kSSize clientSize);
51
52 /**
53 * Sets an I/O cancellation query handler for this receiver object.
54 *
55 * The I/O cancellation query handler will be polled periodically when I/O is blocked
56 * for a non-negligible amount of time. If the cancellation handler returns kERROR_ABORT,
57 * ongoing communication will be terminated.
58 *
59 * @public @memberof GoReceiver
60 * @param receiver Receiver object.
61 * @param function I/O cancellation callback function (or kNULL to unregister).
62 * @param context Context argument for callback (function receiver).
63 * @return Operation status.
64 */
65 GoFx(kStatus) GoReceiver_SetCancelHandler(GoReceiver receiver, kCallbackFx function, kPointer context);
66
67 /**
68 * Sets a callback function that can be used to receive notifications when data is available to be read.
69 *
70 * @public @memberof GoReceiver
71 * @param receiver Receiver object.
72 * @param function Data callback function (or kNULL to unregister).
73 * @param context Context argument for callback (function receiver).
74 * @return Operation status.
75 */
76 GoFx(kStatus) GoReceiver_SetMessageHandler(GoReceiver receiver, GoReceiverMessageFx function, kPointer context);
77
78 /**
79 * Opens a data connection to the specified sensor IP address and port.
80 *
81 * @public @memberof GoReceiver
82 * @param receiver Receiver object.
83 * @param address Sensor IP address.
84 * @param port Sensor data port.
85 * @return Operation status.
86 */
87 GoFx(kStatus) GoReceiver_Open(GoReceiver receiver, kIpAddress address, k32u port);
88
89 /**
90 * Closes the data connection.
91 *
92 * @public @memberof GoReceiver
93 * @param receiver Receiver object.
94 * @return Operation status.
95 */
96 GoFx(kStatus) GoReceiver_Close(GoReceiver receiver);
97
98 /**
99 * Reports whether the receiver object has been opened.
100 *
101 * @public @memberof GoReceiver
102 * @param receiver Receiver object.
103 * @return kTRUE if open; kFALSE otherwise.
104 */
105 GoFx(kBool) GoReceiver_IsOpen(GoReceiver receiver);
106
107 kEndHeader()
108 #include <GoSdk/Internal/GoReceiver.x.h>
109
110 #endif
GoReceiver::GoReceiver_SetBuffers
kStatus GoReceiver_SetBuffers(GoReceiver receiver, kSSize socketSize, kSSize clientSize)
Sets the size of buffers used for receiving data.
GoReceiver::GoReceiver_Open
kStatus GoReceiver_Open(GoReceiver receiver, kIpAddress address, k32u port)
Opens a data connection to the specified sensor IP address and port.
GoReceiver::GoReceiver_Construct
kStatus GoReceiver_Construct(GoReceiver *receiver, kAlloc allocator)
Constructs a GoReceiver object.
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.
Definition: GoReceiver.h:16
GoReceiver::GoReceiver_SetCancelHandler
kStatus GoReceiver_SetCancelHandler(GoReceiver receiver, kCallbackFx function, kPointer context)
Sets an I/O cancellation query handler for this receiver object.
GoReceiver::GoReceiver_IsOpen
kBool GoReceiver_IsOpen(GoReceiver receiver)
Reports whether the receiver object has been opened.
GoReceiver::GoReceiver_Close
kStatus GoReceiver_Close(GoReceiver receiver)
Closes the data connection.
kBeginHeader
kBeginHeader() kStatus GoSdk_Construct(kAssembly *assembly)
Constructs the Gocator SDK library.
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...