Gocator API

- Home
- Types
- Files

All Classes Files Functions Variables Typedefs Macros Modules Pages
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-2018 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 k32u controlPort;
30 k32u upgradePort;
31 k32u healthPort;
32 k32u dataPort;
33 } GoDiscoveryInfo;
34
35 /**
36 * @class GoDiscovery
37 * @extends kObject
38 * @ingroup GoSdk-Internal
39 * @brief Represents a discovery client.
40 */
41 typedef kObject GoDiscovery;
42
43 /** Defines the signature for a discovery enumeration handler. */
44 typedef kStatus (kCall* GoDiscoveryEnumFx)(kPointer context, GoDiscovery discovery, kArrayList info);
45
46 /**
47 * Constructs a GoDiscovery object.
48 *
49 * @public @memberof GoDiscovery
50 * @version Introduced in firmware 4.0.10.27
51 * @param discovery Receives constructed discovery object.
52 * @param enableAutoDiscovery whether or not to enable all interfaces to support running the Discovery Protocol.
53 * @param allocator Memory allocator (or kNULL for default)
54 * @return Operation status.
55 */
56 GoFx(kStatus) GoDiscovery_Construct(GoDiscovery* discovery, kBool enableAutoDiscovery, kAlloc allocator);
57
58 /**
59 * Enumerates sensors present in the network.
60 *
61 * @public @memberof GoDiscovery
62 * @version Introduced in firmware 4.0.10.27
63 * @param discovery Discovery object.
64 * @param infoList List to be populated with sensor descriptors (kArrayList<GoDiscoveryInfo>).
65 * @return Operation status.
66 */
67 GoFx(kStatus) GoDiscovery_Enumerate(GoDiscovery discovery, kArrayList infoList);
68
69 /**
70 * Configures a sensor's network address settings.
71 *
72 * This function uses UDP broadcasts; the sensor and can be on a different subnet than the client.
73 *
74 * The sensor will automatically reboot if the address is successfully changed.
75 *
76 * @public @memberof GoDiscovery
77 * @version Introduced in firmware 4.0.10.27
78 * @param discovery Discovery object.
79 * @param deviceId Sensor device identifier (serial number).
80 * @param address New address information.
81 * @return Operation status.
82 */
83 GoFx(kStatus) GoDiscovery_SetAddress(GoDiscovery discovery, k32u deviceId, const GoAddressInfo* address);
84
85 /**
86 * Retrieves a sensor's network address settings.
87 *
88 * This function uses UDP broadcasts; the sensor and can be on a different subnet than the client.
89 *
90 * @public @memberof GoDiscovery
91 * @version Introduced in firmware 4.0.10.27
92 * @param discovery Discovery object.
93 * @param deviceId Sensor device identifier (serial number).
94 * @param address Receives address information.
95 * @return Operation status.
96 */
97 GoFx(kStatus) GoDiscovery_GetAddress(GoDiscovery discovery, k32u deviceId, GoAddressInfo* address);
98
99 /**
100 * Retrieves a sensor's information.
101 *
102 * This function uses UDP broadcasts; the sensor and can be on a different subnet than the client.
103 *
104 * @public @memberof GoDiscovery
105 * @version Introduced in firmware 4.3.3.124
106 * @param discovery Discovery object.
107 * @param deviceId Sensor device identifier (serial number).
108 * @param info Receives sensor information.
109 * @param allocator Memory allocator. In order to prevent memory leaks,
110 * the received information object should be destroyed when no longer used.
111 * @return Operation status.
112 */
113 GoFx(kStatus) GoDiscovery_GetExtendedInfo(GoDiscovery discovery, k32u deviceId, GoDiscoveryExtInfo* info, kAlloc allocator);
114
115 /**
116 * Sets the enumeration period that will be used when background updates are enabled via StartEnum.
117 *
118 * @public @memberof GoDiscovery
119 * @version Introduced in firmware 4.0.10.27
120 * @param discovery Discovery object.
121 * @param period Enumeration period, in microseconds.
122 * @return Operation status.
123 */
124 GoFx(kStatus) GoDiscovery_SetEnumPeriod(GoDiscovery discovery, k64u period);
125
126 /**
127 * Sets the enumeration callback to be used when background updates are enabled via StartEnum.
128 *
129 * @public @memberof GoDiscovery
130 * @version Introduced in firmware 4.0.10.27
131 * @param discovery Discovery object.
132 * @param function Enumeration callback function (or kNULL to unregister).
133 * @param receiver Receiver argument for callback.
134 * @return Operation status.
135 */
136 GoFx(kStatus) GoDiscovery_SetEnumHandler(GoDiscovery discovery, GoDiscoveryEnumFx function, kPointer receiver);
137
138 /**
139 * Starts periodic background discovery enumeration.
140 *
141 * @public @memberof GoDiscovery
142 * @version Introduced in firmware 4.0.10.27
143 * @param discovery Discovery object.
144 * @param waitFirst kTRUE to block until first enumeration cycle is completed; kFALSE otherwise.
145 * @return Operation status.
146 */
147 GoFx(kStatus) GoDiscovery_StartEnum(GoDiscovery discovery, kBool waitFirst);
148
149 /**
150 * Stops periodic background discovery enumeration.
151 *
152 * @public @memberof GoDiscovery
153 * @version Introduced in firmware 4.0.10.27
154 * @param discovery Discovery object.
155 * @return Operation status.
156 */
157 GoFx(kStatus) GoDiscovery_StopEnum(GoDiscovery discovery);
158
159 /**
160 * Enable or disable running the Gocator Discovery Protocol over the specified
161 * host interface which the given address.
162 *
163 * @public @memberof GoDiscovery
164 * @version Introduced in firmware 4.6.7.157
165 * @param discovery Discovery object.
166 * @param address IP address of interface over which the discovery protocol should run.
167 * @param enable Select whether to enable or disable the interface.
168 * @return Operation status.
169 */
170 GoFx(kStatus) GoDiscovery_SetOneInterface(GoDiscovery discovery, kIpAddress* address, kBool enable);
171
172 /**
173 * Enable running the Gocator Discovery Protocol over all the host interfaces.
174 *
175 * @public @memberof GoDiscovery
176 * @version Introduced in firmware 4.6.7.157
177 * @param discovery Discovery object.
178 * @param enable Select whether to enable or disable the interface.
179 * @return Operation status.
180 */
181 GoFx(kStatus) GoDiscovery_SetAllInterface(GoDiscovery discovery, kBool enable);
182
183 /**
184 * Enables or disables compatibility mode.
185 *
186 * Compatibility mode allows discovery of older firmware but increase
187 * broadcast traffic.
188 *
189 * @public @memberof GoDiscovery
190 * @version Introduced in firmware 5.1.6.0
191 * @param discovery Discovery object.
192 * @param enable Enable or disable compatibility mode.
193 * @return Operation status.
194 */
195 GoFx(kStatus) GoDiscovery_EnableCompatMode(GoDiscovery discovery, kBool enable);
196
197 /**
198 * Gets the current state of compatibility mode.
199 *
200 * @public @memberof GoDiscovery
201 * @version Introduced in firmware 5.1.6.0
202 * @param discovery Discovery object.
203 * @return Compatibility enable flag.
204 */
205 GoFx(kBool) GoDiscovery_CompatModeEnabled(GoDiscovery discovery);
206
207 kEndHeader()
208 #include <GoSdk/Internal/GoDiscovery.x.h>
209
210 #endif
k32u
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.
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.
kArrayList
kObject
kStatus
GoDiscovery
Represents a discovery client.
GoDiscoveryExtInfo
Represents an extended Discovery Information object.
GoDiscoveryEnumFx
kStatus(kCall * GoDiscoveryEnumFx)(kPointer context, GoDiscovery discovery, kArrayList info)
Defines the signature for a discovery enumeration handler.
Definition: GoDiscovery.h:44
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:743