Thanks for your enquiry to PDC!
The InRange and OutOfRange events come asyncronously from the Voyager Pro's dongle when the device goes in and out of range. They arrive as a HeadsetStateChanged to your plugin or application using COM/REST Service:
- HeadsetStateChange.Inrange - headset has come into range
- HeadsetStateChange.OutOfRange - headset has gome out of range
In looking at this problem I was taking at look at this sample code: Presence, Proximity and Caller ID Sample.zip
As you also noticed the code in the sample gets the last known Don or Doff (wearing state):
HeadsetState laststate = m_commandExt.HeadsetState;
m_lightWindow.SetDonnedOnOff((laststate == HeadsetState.Don) ? "On" : "Off"); // apply to light bulb!
One way you could find the initial InRange or OutOfRange state on startup is as follows:
- On initialising of your application or plugin, enable proximity with:
m_commandExt = m_device.HostCommand as IHostCommandExt;
if (m_commandExt != null)
m_commandExt.EnableProximity(true); // enable proximity reporting for device
m_commandExt.GetProximity(); // request to receive asyncrounous near/far proximity event to HeadsetStateChanged event handler. }
catch (Exception e)
MessageBox.Show("Other Exception in RegisterForProximity(): " + e.ToString());
You will then receive some asyncronous event reports from Voyager Pro:
- HeadsetStateChange.Unknown - you will get one of those initially (headset might be OutOfRange at this point)
However, if headset is in range very quickly you will get:
- HeadsetStateChange.Near - headset is near to laptop - you can now assume it is InRange!!!
- HeadsetStateChange.Far - headset is far from laptop - you can now assume it is InRange!!!
If you do not get Near or Far, but only the initial proximity Unknown event, you can assume headset is OutOfRange!!!
Note: as soon as headset comes InRange again (HeadsetStateChange.InRange event) you should re-register for proximity using above code in order to continue using proximity feature.