Query profile name from a device

I had this problem too

I have a generic custom log capability I use on all my drivers, to aid in debug and to allow users to see what’s going on without logcat. This capability is invisible in all views and can only be seen in the history tab.

I then give that log a meaningful Id in the profile of each device.

- id: activitylogger
  label: activitylogger
  capabilities:
  - id: universevoice35900.log
    version: 1

This then allows me then do the following in code to figure out my device type, as each device type has an instance of universevoice35900.log, with a different Id, of course you could do this with any capability.

can_handle = function(opts, driver, device, ...)
    return device:component_exists("activitylogger")
  end,

I hope this helps

4 Likes