Commit cdaccae
committed
feat(http): expose Devices accessor and fix DeviceReceived to fire
Adds a public read-only Devices snapshot accessor on MTConnectHttpClient
and fixes DeviceReceived to actually fire for every parsed device.
The client already cached the wired device model in a private _devices
dictionary populated by ProcessProbeDocument, but never exposed it; the
only public path to the post-probe model was ProbeReceived, which
carries the raw IDevicesResponseDocument before InstanceId stamping.
The new accessor returns an independent Dictionary copy under the same
internal lock the populate path uses, so callers can enumerate without
synchronising against the worker thread.
DeviceReceived previously built an empty outputDevices list, populated
only _devices in the first loop, then iterated the empty list — so the
event was raised zero times across the lifetime of every client. The
fix folds the invocation into the populate loop, keeping the cache and
the event in lockstep and dropping the dead second loop.
The new public Devices member shadows the MTConnect.Devices namespace
inside the class scope, so the two pre-existing in-class references to
that namespace are now fully qualified as MTConnect.Devices.* to keep
their resolution unambiguous.
The matching HttpClientDeviceModel test fixture, added in the previous
commit, transitions from RED to GREEN: the missing accessor was a
compile-error RED, the never-fired event was a behavioural RED, and
both invariants now hold end to end against the AgentRunner-backed
embedded HTTP server.
Closes #176.1 parent 142a4c4 commit cdaccae
1 file changed
Lines changed: 37 additions & 7 deletions
Lines changed: 37 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
182 | 207 | | |
183 | 208 | | |
184 | 209 | | |
185 | 210 | | |
186 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
187 | 216 | | |
188 | 217 | | |
189 | 218 | | |
| |||
835 | 864 | | |
836 | 865 | | |
837 | 866 | | |
838 | | - | |
839 | 867 | | |
840 | 868 | | |
841 | 869 | | |
| |||
846 | 874 | | |
847 | 875 | | |
848 | 876 | | |
849 | | - | |
850 | 877 | | |
851 | | - | |
852 | | - | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
853 | 883 | | |
854 | 884 | | |
855 | 885 | | |
| |||
1092 | 1122 | | |
1093 | 1123 | | |
1094 | 1124 | | |
1095 | | - | |
| 1125 | + | |
1096 | 1126 | | |
1097 | 1127 | | |
1098 | 1128 | | |
| |||
1148 | 1178 | | |
1149 | 1179 | | |
1150 | 1180 | | |
1151 | | - | |
| 1181 | + | |
1152 | 1182 | | |
1153 | 1183 | | |
1154 | 1184 | | |
| |||
0 commit comments