code: def properties_changed(self, sender, changed_properties, invalidated_properties):
          
          if 'Connected' in changed_properties:
              if changed_properties['Connected']:
                  self.connect_succeeded()
              else:
                  self.disconnect_succeeded()
  
          if ('ServicesResolved' in changed_properties and changed_properties['ServicesResolved'] == 1 and
                  not self.services):
              self.services_resolved()
docs: Called when a device property has changed or got invalidated.