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 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 allocator Memory allocator (or kNULL for default)
49  * @return Operation status.
50  */
51 GoFx(kStatus) GoDiscovery_Construct(GoDiscovery* discovery, kAlloc allocator);
52 
53 /**
54  * Enumerates sensors present in the network.
55  *
56  * @public @memberof GoDiscovery
57  * @version Introduced in firmware 4.0.10.27
58  * @param discovery Discovery object.
59  * @param infoList List to be populated with sensor descriptors (kArrayList<GoDiscoveryInfo>).
60  * @return Operation status.
61  */
62 GoFx(kStatus) GoDiscovery_Enumerate(GoDiscovery discovery, kArrayList infoList);
63 
64 /**
65  * Configures a sensor's network address settings.
66  *
67  * This function uses UDP broadcasts; the sensor and can be on a different subnet than the client.
68  *
69  * The sensor will automatically reboot if the address is successfully changed.
70  *
71  * @public @memberof GoDiscovery
72  * @version Introduced in firmware 4.0.10.27
73  * @param discovery Discovery object.
74  * @param deviceId Sensor device identifier (serial number).
75  * @param address New address information.
76  * @return Operation status.
77  */
78 GoFx(kStatus) GoDiscovery_SetAddress(GoDiscovery discovery, k32u deviceId, const GoAddressInfo* address);
79 
80 /**
81  * Retrieves a sensor's network address settings.
82  *
83  * This function uses UDP broadcasts; the sensor and can be on a different subnet than the client.
84  *
85  * @public @memberof GoDiscovery
86  * @version Introduced in firmware 4.0.10.27
87  * @param discovery Discovery object.
88  * @param deviceId Sensor device identifier (serial number).
89  * @param address Receives address information.
90  * @return Operation status.
91  */
92 GoFx(kStatus) GoDiscovery_GetAddress(GoDiscovery discovery, k32u deviceId, GoAddressInfo* address);
93 
94 /**
95  * Retrieves a sensor's information.
96  *
97  * This function uses UDP broadcasts; the sensor and can be on a different subnet than the client.
98  *
99  * @public @memberof GoDiscovery
100  * @version Introduced in firmware 4.3.3.124
101  * @param discovery Discovery object.
102  * @param deviceId Sensor device identifier (serial number).
103  * @param info Receives sensor information.
104  * @param allocator Memory allocator. In order to prevent memory leaks,
105  * the received information object should be destroyed when no longer used.
106  * @return Operation status.
107  */
108 GoFx(kStatus) GoDiscovery_GetExtendedInfo(GoDiscovery discovery, k32u deviceId, GoDiscoveryExtInfo* info, kAlloc allocator);
109 
110 
111 /**
112  * Sets the enumeration period that will be used when background updates are enabled via StartEnum.
113  *
114  * @public @memberof GoDiscovery
115  * @version Introduced in firmware 4.0.10.27
116  * @param discovery Discovery object.
117  * @param period Enumeration period, in microseconds.
118  * @return Operation status.
119  */
120 GoFx(kStatus) GoDiscovery_SetEnumPeriod(GoDiscovery discovery, k64u period);
121 
122 /**
123  * Sets the enumeration callback to be used when background updates are enabled via StartEnum.
124  *
125  * @public @memberof GoDiscovery
126  * @version Introduced in firmware 4.0.10.27
127  * @param discovery Discovery object.
128  * @param function Enumeration callback function (or kNULL to unregister).
129  * @param receiver Receiver argument for callback.
130  * @return Operation status.
131  */
132 GoFx(kStatus) GoDiscovery_SetEnumHandler(GoDiscovery discovery, GoDiscoveryEnumFx function, kPointer receiver);
133 
134 /**
135  * Starts periodic background discovery enumeration.
136  *
137  * @public @memberof GoDiscovery
138  * @version Introduced in firmware 4.0.10.27
139  * @param discovery Discovery object.
140  * @param waitFirst kTRUE to block until first enumeration cycle is completed; kFALSE otherwise.
141  * @return Operation status.
142  */
143 GoFx(kStatus) GoDiscovery_StartEnum(GoDiscovery discovery, kBool waitFirst);
144 
145 /**
146  * Stops periodic background discovery enumeration.
147  *
148  * @public @memberof GoDiscovery
149  * @version Introduced in firmware 4.0.10.27
150  * @param discovery Discovery object.
151  * @return Operation status.
152  */
153 GoFx(kStatus) GoDiscovery_StopEnum(GoDiscovery discovery);
154 
155 kEndHeader()
156 #include <GoSdk/Internal/GoDiscovery.x.h>
157 
158 #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.
kStatus GoDiscovery_Construct(GoDiscovery *discovery, kAlloc allocator)
Constructs a GoDiscovery object.
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.
Essential SDK declarations.
kStatus GoDiscovery_GetExtendedInfo(GoDiscovery discovery, k32u deviceId, GoDiscoveryExtInfo *info, kAlloc allocator)
Retrieves a sensor's information.
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:573