Correct usage of OVR::DeviceManager::EnumerateDevices<>
Hi guys,
I'm currently writing a C# wrapper for the SDK, however my developer kit has not arrived yet, so I can't really test my code. However a friend of mine is currently testing it, and for some reason it doesn't work as expected. I'm guessing that I'm using the aforementioned enumerator incorrectly (assuming it was a .NET style enumerator which points *before* the first element).
Does the following code work as intended, e.g. enumerate all devices attached to the system? I've been browsing through the SDK's source code, however this section and implementation of EnumerateDevices<> is not heavily commencted:
Does IsAvailable() always report true for those cases where CreateDevice() returns non null? The documentation of the SDK says that EnumerateDevices returns an "empty" enumerator, and I'm guessing that IsAvailable() is meant to indicate wether or not it's empty, but this is just a guess on my side.
On a related note, how can I go about deep cloning a DeviceHandle? I'm asking because I would like to represent this functionality as an IEnumeration<IDeviceHandle>, however this kind of relationship is very different fromt he SDK's one, in which an enumerator is a kind of DeviceHandle, and hence moving the enumerator to the next element modifies the handle as well. I think that this would introduce subtle bugs (e.g. users calling EnumeratorDevices.ToList() would end up with a list of N identical device handles).
I'm afraid that I'm no longer in the realm of the public interface of the SDK, however I think that for the moment, it would really help the wrapper.
On another note, which licenses am I allowed to publish this wrapper under? Ideally, I would like to use a very lenient license, so it can be used in commercial and non-commercial products without any hassle. Do you have any information on that as well?
I'm currently writing a C# wrapper for the SDK, however my developer kit has not arrived yet, so I can't really test my code. However a friend of mine is currently testing it, and for some reason it doesn't work as expected. I'm guessing that I'm using the aforementioned enumerator incorrectly (assuming it was a .NET style enumerator which points *before* the first element).
Does the following code work as intended, e.g. enumerate all devices attached to the system? I've been browsing through the SDK's source code, however this section and implementation of EnumerateDevices<> is not heavily commencted:
auto enumerator = _manager->EnumerateDevices<OVR::SensorDevice>(true);
while(enumerator.IsAvailable())
{
// There's a device, use it...
if (!enumerator.Next())
break;
}
Does IsAvailable() always report true for those cases where CreateDevice() returns non null? The documentation of the SDK says that EnumerateDevices returns an "empty" enumerator, and I'm guessing that IsAvailable() is meant to indicate wether or not it's empty, but this is just a guess on my side.
On a related note, how can I go about deep cloning a DeviceHandle? I'm asking because I would like to represent this functionality as an IEnumeration<IDeviceHandle>, however this kind of relationship is very different fromt he SDK's one, in which an enumerator is a kind of DeviceHandle, and hence moving the enumerator to the next element modifies the handle as well. I think that this would introduce subtle bugs (e.g. users calling EnumeratorDevices.ToList() would end up with a list of N identical device handles).
I'm afraid that I'm no longer in the realm of the public interface of the SDK, however I think that for the moment, it would really help the wrapper.
On another note, which licenses am I allowed to publish this wrapper under? Ideally, I would like to use a very lenient license, so it can be used in commercial and non-commercial products without any hassle. Do you have any information on that as well?
