Skip to content

Preserved the original data format example exactly. Dbus signal-> Model #284

@lunasaw

Description

@lunasaw

Hello,

I'd like to use the util in this repository to convert the monitored data from gdbus monitor --system --dest org.bluez into corresponding data structures.

For example, given data in this format:

/: org.freedesktop.DBus.ObjectManager.InterfacesAdded (objectpath '/org/bluez/hci0/dev_A4_C1_38_EF_FB_22', {  
  'org.freedesktop.DBus.Introspectable': @a{sv} {},  
  'org.bluez.Device1': {  
    'Address': <'A4:C1:38:EF:FB:22'>,  
    'AddressType': <'public'>,  
    'Name': <'LYWSD03MMC'>,  
    'Alias': <'LYWSD03MMC'>,  
    'Paired': <false>,  
    'Trusted': <false>,  
    'Blocked': <false>,  
    'LegacyPairing': <false>,  
    'RSSI': <int16 -75>,  
    'Connected': <false>,  
    'UUIDs': <@as []>,  
    'Adapter': <objectpath '/org/bluez/hci0'>,  
    'ServiceData': <{'0000fe95-0000-1000-8000-00805f9b34fb': <[byte 0x58, 0x58, 0x5b, 0x05, 0x3b, 0x22, 0xfb, 0xef, 0x38, 0xc1, 0xa4, 0xf2, 0x25, 0x8c, 0xbd, 0x03, 0xe5, 0x07, 0x00, 0xbe, 0xd3, 0x58, 0x22]>}>,  
    'ServicesResolved': <false>  
  },  
  'org.freedesktop.DBus.Properties': {}  
})  

I want to convert it to this class: org.freedesktop.dbus.interfaces.ObjectManager.InterfacesAdded.

What approach would you recommend? I tried using regex matching but it didn’t work well. I noticed the code already encapsulates this format—could you share how you convert signals into this data model?

Thanks very much for your help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions