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) 2015 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
16 kBeginHeader()
17
18 /**
19 * @struct GoDiscoveryInfo
20 * @extends kValue
21 * @ingroup GoSdk-Internal
22 * @brief Represents discovery information for a single device.
23 */
24 typedef struct GoDiscoveryInfo
25 {
26 k32u id; ///< device identifier (serial number)
27 GoAddressInfo address; ///< network configuration
28 } GoDiscoveryInfo;
29
30 /**
31 * @class GoDiscovery
32 * @extends kObject
33 * @ingroup GoSdk-Internal
34 * @brief Represents a discovery client.
35 */
36 typedef kObject GoDiscovery;
37
38 /** Defines the signature for a discovery enumeration handler. */
39 typedef kStatus (kCall* GoDiscoveryEnumFx)(kPointer context, GoDiscovery discovery, kArrayList info);
40
41 /**
42 * Constructs a GoDiscovery object.
43 *
44 * @public @memberof GoDiscovery
45 * @version Introduced in firmware 4.0.10.27
46 * @param discovery Receives constructed discovery object.
47 * @param allocator Memory allocator (or kNULL for default)
48 * @return Operation status.
49 */
50 GoFx(kStatus) GoDiscovery_Construct(GoDiscovery* discovery, kAlloc allocator);
51
52 /**
53 * Enumerates sensors present in the network.
54 *
55 * @public @memberof GoDiscovery
56 * @version Introduced in firmware 4.0.10.27
57 * @param discovery Discovery object.
58 * @param infoList List to be populated with sensor descriptors (kArrayList<GoDiscoveryInfo>).
59 * @return Operation status.
60 */
61 GoFx(kStatus) GoDiscovery_Enumerate(GoDiscovery discovery, kArrayList infoList);
62
63 /**
64 * Configures a sensor's network address settings.
65 *
66 * This function uses UDP broadcasts; the sensor and can be on a different subnet than the client.
67 *
68 * The sensor will automatically reboot if the address is successfully changed.
69 *
70 * @public @memberof GoDiscovery
71 * @version Introduced in firmware 4.0.10.27
72 * @param discovery Discovery object.
73 * @param deviceId Sensor device identifier (serial number).
74 * @param address New address information.
75 * @return Operation status.
76 */
77 GoFx(kStatus) GoDiscovery_SetAddress(GoDiscovery discovery, k32u deviceId, const GoAddressInfo* address);
78
79 /**
80 * Retrieves a sensor's network address settings.
81 *
82 * This function uses UDP broadcasts; the sensor and can be on a different subnet than the client.
83 *
84 * @public @memberof GoDiscovery
85 * @version Introduced in firmware 4.0.10.27
86 * @param discovery Discovery object.
87 * @param deviceId Sensor device identifier (serial number).
88 * @param address Receives address information.
89 * @return Operation status.
90 */
91 GoFx(kStatus) GoDiscovery_GetAddress(GoDiscovery discovery, k32u deviceId, GoAddressInfo* address);
92
93 /**
94 * Sets the enumeration period that will be used when background updates are enabled via StartEnum.
95 *
96 * @public @memberof GoDiscovery
97 * @version Introduced in firmware 4.0.10.27
98 * @param discovery Discovery object.
99 * @param period Enumeration period, in microseconds.
100 * @return Operation status.
101 */
102 GoFx(kStatus) GoDiscovery_SetEnumPeriod(GoDiscovery discovery, k64u period);
103
104 /**
105 * Sets the enumeration callback to be used when background updates are enabled via StartEnum.
106 *
107 * @public @memberof GoDiscovery
108 * @version Introduced in firmware 4.0.10.27
109 * @param discovery Discovery object.
110 * @param function Enumeration callback function (or kNULL to unregister).
111 * @param receiver Receiver argument for callback.
112 * @return Operation status.
113 */
114 GoFx(kStatus) GoDiscovery_SetEnumHandler(GoDiscovery discovery, GoDiscoveryEnumFx function, kPointer receiver);
115
116 /**
117 * Starts periodic background discovery enumeration.
118 *
119 * @public @memberof GoDiscovery
120 * @version Introduced in firmware 4.0.10.27
121 * @param discovery Discovery object.
122 * @param waitFirst kTRUE to block until first enumeration cycle is completed; kFALSE otherwise.
123 * @return Operation status.
124 */
125 GoFx(kStatus) GoDiscovery_StartEnum(GoDiscovery discovery, kBool waitFirst);
126
127 /**
128 * Stops periodic background discovery enumeration.
129 *
130 * @public @memberof GoDiscovery
131 * @version Introduced in firmware 4.0.10.27
132 * @param discovery Discovery object.
133 * @return Operation status.
134 */
135 GoFx(kStatus) GoDiscovery_StopEnum(GoDiscovery discovery);
136
137 kEndHeader()
138 #include <GoSdk/Internal/GoDiscovery.x.h>
139
140 #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:24
GoDiscovery::GoDiscovery_GetAddress
kStatus GoDiscovery_GetAddress(GoDiscovery discovery, k32u deviceId, GoAddressInfo *address)
Retrieves a sensor's network address settings.
GoDiscovery::GoDiscovery_Construct
kStatus GoDiscovery_Construct(GoDiscovery *discovery, kAlloc allocator)
Constructs a GoDiscovery object.
GoDiscoveryInfo::address
GoAddressInfo address
network configuration
Definition: GoDiscovery.h:27
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
GoSdkDef.h
Essential SDK declarations.
GoDiscovery::GoDiscovery_Enumerate
kStatus GoDiscovery_Enumerate(GoDiscovery discovery, kArrayList infoList)
Enumerates sensors present in the network.
kArrayList
kObject
kStatus
GoDiscovery
Represents a discovery client.
GoDiscoveryEnumFx
kStatus(kCall * GoDiscoveryEnumFx)(kPointer context, GoDiscovery discovery, kArrayList info)
Defines the signature for a discovery enumeration handler.
Definition: GoDiscovery.h:39
kBool
GoDiscoveryInfo::id
k32u id
device identifier (serial number)
Definition: GoDiscovery.h:26
GoDiscovery::GoDiscovery_StartEnum
kStatus GoDiscovery_StartEnum(GoDiscovery discovery, kBool waitFirst)
Starts periodic background discovery enumeration.
GoAddressInfo
Sensor network address settings.
Definition: GoSdkDef.h:571