@@ -255,67 +255,78 @@ type unitInfoField struct {
255
255
///////////////////////////////////////
256
256
///////////////////////////////////////
257
257
258
- func (m statusField ) GetAddressString () string {
258
+ func (s statusField ) GetAddressString () string {
259
259
statusRequestType := ""
260
- switch m .statusRequestType {
260
+ switch s .statusRequestType {
261
261
case StatusRequestTypeBinaryState :
262
262
statusRequestType = "binary"
263
263
case StatusRequestTypeLevel :
264
264
statusRequestType = "level"
265
- statusRequestType += fmt .Sprintf ("=0x%x" , * m .startingGroupAddressLabel )
265
+ statusRequestType += fmt .Sprintf ("=0x%x" , * s .startingGroupAddressLabel )
266
266
}
267
- return fmt .Sprintf ("status/%s/%s" , statusRequestType , m .application )
267
+ return fmt .Sprintf ("status/%s/%s" , statusRequestType , s .application )
268
268
}
269
269
270
- func (m statusField ) GetStatusRequestType () StatusRequestType {
271
- return m .statusRequestType
270
+ func (s statusField ) GetStatusRequestType () StatusRequestType {
271
+ return s .statusRequestType
272
272
}
273
273
274
- func (m statusField ) GetStartingGroupAddressLabel () * byte {
275
- return m .startingGroupAddressLabel
274
+ func (s statusField ) GetStartingGroupAddressLabel () * byte {
275
+ return s .startingGroupAddressLabel
276
276
}
277
277
278
- func (m statusField ) GetApplication () readWriteModel.ApplicationIdContainer {
279
- return m .application
278
+ func (s statusField ) GetApplication () readWriteModel.ApplicationIdContainer {
279
+ return s .application
280
280
}
281
281
282
- func (m statusField ) GetTypeName () string {
282
+ func (s statusField ) GetTypeName () string {
283
283
return STATUS .GetName ()
284
284
}
285
285
286
- func (m statusField ) GetQuantity () uint16 {
287
- return m .numElements
286
+ func (s statusField ) GetQuantity () uint16 {
287
+ return s .numElements
288
288
}
289
289
290
- func (m statusField ) Serialize (writeBuffer utils.WriteBuffer ) error {
291
- if err := writeBuffer .PushContext (m .fieldType .GetName ()); err != nil {
290
+ func (s statusField ) Serialize (writeBuffer utils.WriteBuffer ) error {
291
+ if err := writeBuffer .PushContext (s .fieldType .GetName ()); err != nil {
292
292
return err
293
293
}
294
294
295
- if err := writeBuffer .WriteUint8 ("statusRequestType" , 8 , uint8 (m .statusRequestType ), utils .WithAdditionalStringRepresentation (m .statusRequestType .String ())); err != nil {
295
+ if err := writeBuffer .WriteUint8 ("statusRequestType" , 8 , uint8 (s .statusRequestType ), utils .WithAdditionalStringRepresentation (s .statusRequestType .String ())); err != nil {
296
296
return err
297
297
}
298
- if m .startingGroupAddressLabel != nil {
299
- if err := writeBuffer .WriteUint8 ("startingGroupAddressLabel" , 8 , * m .startingGroupAddressLabel ); err != nil {
298
+ if s .startingGroupAddressLabel != nil {
299
+ if err := writeBuffer .WriteUint8 ("startingGroupAddressLabel" , 8 , * s .startingGroupAddressLabel ); err != nil {
300
300
return err
301
301
}
302
302
}
303
- if err := writeBuffer .WriteUint8 ("application" , 8 , uint8 (m .application ), utils .WithAdditionalStringRepresentation (m .application .String ())); err != nil {
303
+ if err := writeBuffer .WriteUint8 ("application" , 8 , uint8 (s .application ), utils .WithAdditionalStringRepresentation (s .application .String ())); err != nil {
304
304
return err
305
305
}
306
306
307
- if err := writeBuffer .PopContext (m .fieldType .GetName ()); err != nil {
307
+ if err := writeBuffer .PopContext (s .fieldType .GetName ()); err != nil {
308
308
return err
309
309
}
310
310
return nil
311
311
}
312
312
313
+ func (s statusField ) String () string {
314
+ writeBuffer := utils .NewWriteBufferBoxBasedWithOptions (true , true )
315
+ if err := writeBuffer .WriteSerializable (s ); err != nil {
316
+ return err .Error ()
317
+ }
318
+ return writeBuffer .GetBox ().String ()
319
+ }
320
+
313
321
func (c calField ) GetUnitAddress () readWriteModel.UnitAddress {
314
322
return c .unitAddress
315
323
}
316
324
317
325
func (c calField ) Serialize (writeBuffer utils.WriteBuffer ) error {
318
- return c .unitAddress .Serialize (writeBuffer )
326
+ if unitAddress := c .unitAddress ; unitAddress != nil {
327
+ return c .unitAddress .Serialize (writeBuffer )
328
+ }
329
+ return nil
319
330
}
320
331
321
332
func (c calField ) String () string {
0 commit comments