Jump to content
C4 Forums | Control4

Axium

c4Forums Member
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Axium

  1. Thanks @Andrew H for the tips. I found C4:GetDevices, which returns all devices and proxies, so I wrote a function for creating an array to map proxy IDs to device IDs: function get_proxy_device_map() local map = {} local devices = C4:GetDevices() -- could add filtering options here for k,v in pairs(devices) do local proxies = v.proxies or {} for k2,_ in pairs(proxies) do map[k2] = k end end return map end By mapping the proxy IDs to the device IDs, we were able to access the variables on connected devices.
  2. We are writing several drivers that interact and would like to be able to access (read) variables created by other connected devices. However we are running into problems due to the differentiation of device (or "protocol") IDs and proxy IDs. The connections between devices can be inspected using the C4:GetBoundConsumerDevices and C4:GetBoundProviderDevice functions but these appear to only deal with proxy IDs, i.e. the parameters taken by the functions and the values returned by the functions are all proxy IDs. There does not appear to be any way to convert a returned proxy ID to a device ID, so in other words we cannot get the device ID of any connected device. (It is possible to get the proxy IDs for any particular device using C4:GetProxyDevicesById() but the reverse does not appear to exist.) Variables are created using the C4:AddVariable function but they appear to be created under the device rather than the proxy, so if another driver wants to access a variable using the C4:GetDeviceVariables function, then its device ID parameter needs to be the device ID rather than the proxy ID. Therefore there does not seem to be any way for one device to be able to inspect a connected device's variables. Is there a way around this limitation or another function that we're not aware of? Is there a better way to do this?
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.