@@ -187,48 +187,60 @@ private CosemObject getAllDataFromObisCode(
187
187
final DlmsDevice device ,
188
188
final ObjectListElement objectListElement ) {
189
189
190
- final List < DataObject > attributeData =
191
- this . getAllDataFromAttributes ( conn , device , objectListElement ) ;
190
+ String errorMessage = "" ;
191
+ List < DataObject > attributeData ;
192
192
193
- return this .dataDecoder .decodeObjectData (objectListElement , attributeData , dlmsProfile );
193
+ try {
194
+ attributeData = this .getAllDataFromAttributes (conn , device , objectListElement );
195
+ } catch (final Exception e ) {
196
+ log .error ("Failed reading attributes from " + objectListElement .getLogicalName (), e );
197
+ errorMessage = "Failed reading attributes" ;
198
+ attributeData = List .of ();
199
+ }
200
+
201
+ final CosemObject object =
202
+ this .dataDecoder .decodeObjectData (objectListElement , attributeData , dlmsProfile );
203
+
204
+ if (!errorMessage .isEmpty ()) {
205
+ object .addNote (errorMessage );
206
+ }
207
+
208
+ return object ;
194
209
}
195
210
196
211
private List <DataObject > getAllDataFromAttributes (
197
212
final DlmsConnectionManager conn ,
198
213
final DlmsDevice device ,
199
- final ObjectListElement objectListElement ) {
200
- try {
201
- final int classId = objectListElement .getClassId ();
202
- final String obisCode = objectListElement .getLogicalName ();
203
- final AttributeAddress [] addresses =
204
- objectListElement .getAttributes ().stream ()
205
- .map (item -> new AttributeAddress (classId , obisCode , item .getAttributeId ()))
206
- .toArray (AttributeAddress []::new );
207
-
208
- conn .getDlmsMessageListener ()
209
- .setDescription (
210
- "RetrieveAllAttributeValues, retrieve attributes: "
211
- + JdlmsObjectToStringUtil .describeAttributes (addresses ));
214
+ final ObjectListElement objectListElement )
215
+ throws ProtocolAdapterException {
212
216
213
- log .debug (
214
- "Retrieving data for {} attributes of class id: {}, obis code: {}" ,
215
- addresses .length ,
216
- classId ,
217
- obisCode );
218
- final List <GetResult > getResults = this .dlmsHelper .getWithList (conn , device , addresses );
219
-
220
- if (getResults .stream ()
221
- .allMatch (result -> result .getResultCode () == AccessResultCode .SUCCESS )) {
222
- log .debug ("ResultCode: SUCCESS" );
223
- } else {
224
- log .debug ("ResultCode not SUCCESS for one or more attributes" );
225
- }
226
-
227
- return getResults .stream ().map (GetResult ::getResultData ).toList ();
228
- } catch (final Exception e ) {
229
- log .debug ("Failed reading attributes from " + objectListElement .getLogicalName (), e );
230
- return List .of ();
217
+ final int classId = objectListElement .getClassId ();
218
+ final String obisCode = objectListElement .getLogicalName ();
219
+ final AttributeAddress [] addresses =
220
+ objectListElement .getAttributes ().stream ()
221
+ .map (item -> new AttributeAddress (classId , obisCode , item .getAttributeId ()))
222
+ .toArray (AttributeAddress []::new );
223
+
224
+ conn .getDlmsMessageListener ()
225
+ .setDescription (
226
+ "RetrieveAllAttributeValues, retrieve attributes: "
227
+ + JdlmsObjectToStringUtil .describeAttributes (addresses ));
228
+
229
+ log .debug (
230
+ "Retrieving data for {} attributes of class id: {}, obis code: {}" ,
231
+ addresses .length ,
232
+ classId ,
233
+ obisCode );
234
+ final List <GetResult > getResults = this .dlmsHelper .getWithList (conn , device , addresses );
235
+
236
+ if (getResults .stream ()
237
+ .allMatch (result -> result .getResultCode () == AccessResultCode .SUCCESS )) {
238
+ log .debug ("ResultCode: SUCCESS" );
239
+ } else {
240
+ log .debug ("ResultCode not SUCCESS for one or more attributes" );
231
241
}
242
+
243
+ return getResults .stream ().map (GetResult ::getResultData ).toList ();
232
244
}
233
245
234
246
private List <ObjectListElement > getAllObjectListElements (
0 commit comments