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