@@ -255,67 +255,78 @@ type unitInfoField struct {
255255///////////////////////////////////////
256256///////////////////////////////////////
257257
258- func (m statusField ) GetAddressString () string {
258+ func (s statusField ) GetAddressString () string {
259259 statusRequestType := ""
260- switch m .statusRequestType {
260+ switch s .statusRequestType {
261261 case StatusRequestTypeBinaryState :
262262 statusRequestType = "binary"
263263 case StatusRequestTypeLevel :
264264 statusRequestType = "level"
265- statusRequestType += fmt .Sprintf ("=0x%x" , * m .startingGroupAddressLabel )
265+ statusRequestType += fmt .Sprintf ("=0x%x" , * s .startingGroupAddressLabel )
266266 }
267- return fmt .Sprintf ("status/%s/%s" , statusRequestType , m .application )
267+ return fmt .Sprintf ("status/%s/%s" , statusRequestType , s .application )
268268}
269269
270- func (m statusField ) GetStatusRequestType () StatusRequestType {
271- return m .statusRequestType
270+ func (s statusField ) GetStatusRequestType () StatusRequestType {
271+ return s .statusRequestType
272272}
273273
274- func (m statusField ) GetStartingGroupAddressLabel () * byte {
275- return m .startingGroupAddressLabel
274+ func (s statusField ) GetStartingGroupAddressLabel () * byte {
275+ return s .startingGroupAddressLabel
276276}
277277
278- func (m statusField ) GetApplication () readWriteModel.ApplicationIdContainer {
279- return m .application
278+ func (s statusField ) GetApplication () readWriteModel.ApplicationIdContainer {
279+ return s .application
280280}
281281
282- func (m statusField ) GetTypeName () string {
282+ func (s statusField ) GetTypeName () string {
283283 return STATUS .GetName ()
284284}
285285
286- func (m statusField ) GetQuantity () uint16 {
287- return m .numElements
286+ func (s statusField ) GetQuantity () uint16 {
287+ return s .numElements
288288}
289289
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 {
292292 return err
293293 }
294294
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 {
296296 return err
297297 }
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 {
300300 return err
301301 }
302302 }
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 {
304304 return err
305305 }
306306
307- if err := writeBuffer .PopContext (m .fieldType .GetName ()); err != nil {
307+ if err := writeBuffer .PopContext (s .fieldType .GetName ()); err != nil {
308308 return err
309309 }
310310 return nil
311311}
312312
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+
313321func (c calField ) GetUnitAddress () readWriteModel.UnitAddress {
314322 return c .unitAddress
315323}
316324
317325func (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
319330}
320331
321332func (c calField ) String () string {
0 commit comments