Gocator API

GoDiscovery.h
Go to the documentation of this file.
1 /**
2 * @file GoDiscovery.h
3 * @brief Declares discovery-related types.
4 *
5 * @internal
6 * Copyright (C) 2016-2020 by LMI Technologies Inc.
7 * Licensed under the MIT License.
8 * Redistributed files must retain the above copyright notice.
9 */
10 #ifndef GO_SDK_DISCOVERY_H
11 #define GO_SDK_DISCOVERY_H
12
13 #include <GoSdk/GoSdkDef.h>
14 #include <kApi/Data/kArrayList.h>
15 #include <GoSdk/Messages/GoDiscoveryExtInfo.h>
16
17 kBeginHeader()
18
19 /**
20 * @struct GoDiscoveryInfo
21 * @extends kValue
22 * @ingroup GoSdk-Internal
23 * @brief Represents discovery information for a single device.
24 */
25 typedef struct GoDiscoveryInfo
26 {
27 k32u id; ///< device identifier (serial number)
28 GoAddressInfo address; ///< network configuration
29 GoPortInfo ports;
30
31 // Model name of the sensor.
32 kText32 model;
33 // Gocator firmware version the sensor is running.
34 kVersion version;
35 // opMode: indicates if the main controller (host) is:
36 // a. a virtual sensor, or
37 // b. a standalone sensor, or
38 // c. an accelerator host that is accelerating a sensor.
39 GoDiscoveryOpMode opMode;
40 // If opMode indicates main controller is an accelerator host,
41 // then the IP address of the accelerated sensor
42 // is stored in the following field.
43 // Otherwise, this field is not meaningful.
44 kIpAddress accelSensorIpAddress;
45
46 // IP address of the discovery server that sent the discovery information
47 // about the sensor. This can be the physical sensor or a host controller
48 // (eg. virtual sensor, accelerated sensor).
49 kIpAddress discoveryServerAddress;
50 } GoDiscoveryInfo;
51
52 /**
53 * @class GoDiscovery
54 * @extends kObject
55 * @ingroup GoSdk-Internal
56 * @brief Represents a discovery client.
57 */
58 typedef kObject GoDiscovery;
59
60 /** Defines the signature for a discovery enumeration handler. */
61 typedef kStatus (kCall* GoDiscoveryEnumFx)(kPointer context, GoDiscovery discovery, kArrayList info);
62
63 /**
64 * Constructs a GoDiscovery object.
65 *
66 * @public @memberof GoDiscovery
67 * @version Introduced in firmware 4.0.10.27
68 * @param discovery Receives constructed discovery object.
69 * @param enableAutoDiscovery whether or not to enable all interfaces to support running the Discovery Protocol.
70 * @param allocator Memory allocator (or kNULL for default)
71 * @return Operation status.
72 */
73 GoFx(kStatus) GoDiscovery_Construct(GoDiscovery* discovery, kBool enableAutoDiscovery, kAlloc allocator);
74
75 /**
76 * Enumerates sensors present in the network.
77 *
78 * @public @memberof GoDiscovery
79 * @version Introduced in firmware 4.0.10.27
80 * @param discovery Discovery object.
81 * @param infoList List to be populated with sensor descriptors (kArrayList<GoDiscoveryInfo>).
82 * @return Operation status.
83 */
84 GoFx(kStatus) GoDiscovery_Enumerate(GoDiscovery discovery, kArrayList infoList);
85
86 /**
87 * Configures a sensor's network address settings.
88 *
89 * This function uses UDP broadcasts; the sensor and can be on a different subnet than the client.
90 *
91 * The sensor will automatically reboot if the address is successfully changed.
92 *
93 * @public @memberof GoDiscovery
94 * @version Introduced in firmware 4.0.10.27
95 * @param discovery Discovery object.
96 * @param deviceId Sensor device identifier (serial number).
97 * @param address New address information.
98 * @return Operation status.
99 */
100 GoFx(kStatus) GoDiscovery_SetAddress(GoDiscovery discovery, k32u deviceId, const GoAddressInfo* address);
101
102 /**
103 * Retrieves a sensor's network address settings.
104 *
105 * This function uses UDP broadcasts; the sensor and can be on a different subnet than the client.
106 *
107 * @public @memberof GoDiscovery
108 * @version Introduced in firmware 4.0.10.27
109 * @param discovery Discovery object.
110 * @param deviceId Sensor device identifier (serial number).
111 * @param address Receives address information.
112 * @return Operation status.
113 */
114 GoFx(kStatus) GoDiscovery_GetAddress(GoDiscovery discovery, k32u deviceId, GoAddressInfo* address);
115
116 /**
117 * Retrieves a sensor's information.
118 *
119 * This function uses UDP broadcasts; the sensor and can be on a different subnet than the client.
120 *
121 * @public @memberof GoDiscovery
122 * @version Introduced in firmware 4.3.3.124
123 * @param discovery Discovery object.
124 * @param deviceId Sensor device identifier (serial number).
125 * @param info Receives sensor information.
126 * @param allocator Memory allocator. In order to prevent memory leaks,
127 * the received information object should be destroyed when no longer used.
128 * @return Operation status.
129 */
130 GoFx(kStatus) GoDiscovery_GetExtendedInfo(GoDiscovery discovery, k32u deviceId, GoDiscoveryExtInfo* info, kAlloc allocator);
131
132 /**
133 * Sets the enumeration period that will be used when background updates are enabled via StartEnum.
134 *
135 * @public @memberof GoDiscovery
136 * @version Introduced in firmware 4.0.10.27
137 * @param discovery Discovery object.
138 * @param period Enumeration period, in microseconds.
139 * @return Operation status.
140 */
141 GoFx(kStatus) GoDiscovery_SetEnumPeriod(GoDiscovery discovery, k64u period);
142
143 /**
144 * Sets the enumeration callback to be used when background updates are enabled via StartEnum.
145 *
146 * @public @memberof GoDiscovery
147 * @version Introduced in firmware 4.0.10.27
148 * @param discovery Discovery object.
149 * @param function Enumeration callback function (or kNULL to unregister).
150 * @param receiver Receiver argument for callback.
151 * @return Operation status.
152 */
153 GoFx(kStatus) GoDiscovery_SetEnumHandler(GoDiscovery discovery, GoDiscoveryEnumFx function, kPointer receiver);
154
155 /**
156 * Starts periodic background discovery enumeration.
157 *
158 * @public @memberof GoDiscovery
159 * @version Introduced in firmware 4.0.10.27
160 * @param discovery Discovery object.
161 * @param waitFirst kTRUE to block until first enumeration cycle is completed; kFALSE otherwise.
162 * @return Operation status.
163 */
164 GoFx(kStatus) GoDiscovery_StartEnum(GoDiscovery discovery, kBool waitFirst);
165
166 /**
167 * Stops periodic background discovery enumeration.
168 *
169 * @public @memberof GoDiscovery
170 * @version Introduced in firmware 4.0.10.27
171 * @param discovery Discovery object.
172 * @return Operation status.
173 */
174 GoFx(kStatus) GoDiscovery_StopEnum(GoDiscovery discovery);
175
176 /**
177 * Enable or disable running the Gocator Discovery Protocol over the specified
178 * host interface which the given address.
179 *
180 * @public @memberof GoDiscovery
181 * @version Introduced in firmware 4.6.7.157
182 * @param discovery Discovery object.
183 * @param address IP address of interface over which the discovery protocol should run.
184 * @param enable Select whether to enable or disable the interface.
185 * @return Operation status.
186 */
187 GoFx(kStatus) GoDiscovery_SetOneInterface(GoDiscovery discovery, kIpAddress* address, kBool enable);
188
189 /**
190 * Enable running the Gocator Discovery Protocol over all the host interfaces.
191 *
192 * @public @memberof GoDiscovery
193 * @version Introduced in firmware 4.6.7.157
194 * @param discovery Discovery object.
195 * @param enable Select whether to enable or disable the interface.
196 * @return Operation status.
197 */
198 GoFx(kStatus) GoDiscovery_SetAllInterface(GoDiscovery discovery, kBool enable);
199
200 /**
201 * Enables or disables compatibility mode.
202 *
203 * Compatibility mode allows discovery of older firmware but increase
204 * broadcast traffic.
205 *
206 * @public @memberof GoDiscovery
207 * @version Introduced in firmware 5.2.18.3
208 * @param discovery Discovery object.
209 * @param enable Enable or disable compatibility mode.
210 * @return Operation status.
211 */
212 GoFx(kStatus) GoDiscovery_EnableCompatMode(GoDiscovery discovery, kBool enable);
213
214 /**
215 * Gets the current state of compatibility mode.
216 *
217 * @public @memberof GoDiscovery
218 * @version Introduced in firmware 5.2.18.3
219 * @param discovery Discovery object.
220 * @return Compatibility enable flag.
221 */
222 GoFx(kBool) GoDiscovery_CompatModeEnabled(GoDiscovery discovery);
223
224 kEndHeader()
225 #include <GoSdk/Internal/GoDiscovery.x.h>
226
227 #endif
k32u
GoPortInfo
Ports used from a source device.
Definition: GoSdkDef.h:764
GoDiscoveryEnumFx
kStatus(kCall * GoDiscoveryEnumFx)(kPointer context, GoDiscovery discovery, kArrayList info)
Defines the signature for a discovery enumeration handler.
Definition: GoDiscovery.h:61
k64u
GoDiscovery::GoDiscovery_SetAddress
kStatus GoDiscovery_SetAddress(GoDiscovery discovery, k32u deviceId, const GoAddressInfo *address)
Configures a sensor's network address settings.
GoDiscovery::GoDiscovery_StopEnum
kStatus GoDiscovery_StopEnum(GoDiscovery discovery)
Stops periodic background discovery enumeration.
kPointer
GoDiscovery::GoDiscovery_SetEnumPeriod
kStatus GoDiscovery_SetEnumPeriod(GoDiscovery discovery, k64u period)
Sets the enumeration period that will be used when background updates are enabled via StartEnum.
GoDiscoveryInfo
Represents discovery information for a single device.
Definition: GoDiscovery.h:25
GoDiscovery::GoDiscovery_GetAddress
kStatus GoDiscovery_GetAddress(GoDiscovery discovery, k32u deviceId, GoAddressInfo *address)
Retrieves a sensor's network address settings.
GoDiscoveryInfo::address
GoAddressInfo address
network configuration
Definition: GoDiscovery.h:28
GoDiscovery::GoDiscovery_SetEnumHandler
kStatus GoDiscovery_SetEnumHandler(GoDiscovery discovery, GoDiscoveryEnumFx function, kPointer receiver)
Sets the enumeration callback to be used when background updates are enabled via StartEnum.
kArrayList.h
kAlloc
kIpAddress
GoDiscoveryExtInfo.h
Declares the GoDiscoveryExtInfo class and related types.
GoDiscoveryOpMode
Represents operational mode of the main controller responding to the discovery protocol.
GoDiscovery::GoDiscovery_SetOneInterface
kStatus GoDiscovery_SetOneInterface(GoDiscovery discovery, kIpAddress *address, kBool enable)
Enable or disable running the Gocator Discovery Protocol over the specified host interface which the ...
GoDiscovery::GoDiscovery_EnableCompatMode
kStatus GoDiscovery_EnableCompatMode(GoDiscovery discovery, kBool enable)
Enables or disables compatibility mode.
GoSdkDef.h
Essential SDK declarations.
GoDiscovery::GoDiscovery_GetExtendedInfo
kStatus GoDiscovery_GetExtendedInfo(GoDiscovery discovery, k32u deviceId, GoDiscoveryExtInfo *info, kAlloc allocator)
Retrieves a sensor's information.
GoDiscovery::GoDiscovery_SetAllInterface
kStatus GoDiscovery_SetAllInterface(GoDiscovery discovery, kBool enable)
Enable running the Gocator Discovery Protocol over all the host interfaces.
GoDiscovery::GoDiscovery_Construct
kStatus GoDiscovery_Construct(GoDiscovery *discovery, kBool enableAutoDiscovery, kAlloc allocator)
Constructs a GoDiscovery object.
GoDiscovery::GoDiscovery_Enumerate
kStatus GoDiscovery_Enumerate(GoDiscovery discovery, kArrayList infoList)
Enumerates sensors present in the network.
GoDiscovery::GoDiscovery_CompatModeEnabled
kBool GoDiscovery_CompatModeEnabled(GoDiscovery discovery)
Gets the current state of compatibility mode.
kText32
kArrayList
kObject
kVersion
kStatus
GoDiscovery
Represents a discovery client.
GoDiscoveryExtInfo
Represents an extended Discovery Information object.
kBool
GoDiscoveryInfo::id
k32u id
device identifier (serial number)
Definition: GoDiscovery.h:27
GoDiscovery::GoDiscovery_StartEnum
kStatus GoDiscovery_StartEnum(GoDiscovery discovery, kBool waitFirst)
Starts periodic background discovery enumeration.
GoAddressInfo
Sensor network address settings.
Definition: GoSdkDef.h:750