Device messages and enumeration
Hey Rift Peeps.
I have a question about device messages and enumeration as the messaging is not occurring as I would have expected, but it is possible that my expectations are incorrect. Please keep in mind that I have my Rift dev kit plugged in and working on my machine while going through this.
In the first case I create a DeviceManager object and pass in a listener object (my own class that is derived from OVR::MessageHandler). When everything starts up, I do not receive any OVR::Message_DeviceAdded messages to tell me about my HMD and its sensor. I figured that was fine as I would only receive a message when a device is plugged in while my DeviceManager is running (haven't actually tested this yet).
So I follow the example and enumerate the devices from the DeviceManager. Interestingly, while I am within mDeviceManager->EnumerateDevices<OVR::HMDDevice>() my listener is called with OVR::Message_DeviceAdded messages for both devices. Then EnumerateDevices<>() returns and I can then continue on with creating the HMD device instance, etc.
I'm confused why I would receive the OVR::Message_DeviceAdded message during the enumeration step. Does this mean that I should actually handle all of my device creation within the listener and not do it following the enumeration at all (which is where the examples do it)? Would one, then, only do device creation immediately following an enumeration if you don't have a listener already set up?
Personally, it seems confusing to me that the enumeration would call the listener. This wouldn't allow for an ad hoc enumeration without adding some internal checks to my own code (i.e. an ignore message flag).
- Dave
I have a question about device messages and enumeration as the messaging is not occurring as I would have expected, but it is possible that my expectations are incorrect. Please keep in mind that I have my Rift dev kit plugged in and working on my machine while going through this.
In the first case I create a DeviceManager object and pass in a listener object (my own class that is derived from OVR::MessageHandler). When everything starts up, I do not receive any OVR::Message_DeviceAdded messages to tell me about my HMD and its sensor. I figured that was fine as I would only receive a message when a device is plugged in while my DeviceManager is running (haven't actually tested this yet).
So I follow the example and enumerate the devices from the DeviceManager. Interestingly, while I am within mDeviceManager->EnumerateDevices<OVR::HMDDevice>() my listener is called with OVR::Message_DeviceAdded messages for both devices. Then EnumerateDevices<>() returns and I can then continue on with creating the HMD device instance, etc.
I'm confused why I would receive the OVR::Message_DeviceAdded message during the enumeration step. Does this mean that I should actually handle all of my device creation within the listener and not do it following the enumeration at all (which is where the examples do it)? Would one, then, only do device creation immediately following an enumeration if you don't have a listener already set up?
Personally, it seems confusing to me that the enumeration would call the listener. This wouldn't allow for an ad hoc enumeration without adding some internal checks to my own code (i.e. an ignore message flag).
- Dave
