Plantronics SDK developers can access the ICOMATDCommand interface by casting the HostCommand property in IDevice. If it returns a valid interface then the device supports caller ID. Applications can also register for mobile presence events by registering for the PresenceChanged event exposed in DeviceEvents property or by accessing the ATDStateChanged event exposed in DeviceListener property of IDevice.
Following interfaces ICOMATDCommand, ICOMMobilePresenceEvents, IDeviceListenerEvents will expose Mobile presence event and caller ID as part of the Plantronics SDK. These interfaces can be accessed by applications that directly interface with the device manager or plug-ins that interface with the Plantronics SDK. This feature is currently support only with BT300 dongle and a Voyager Legend UC Headset which is multipoint paired and connected to a supported mobile phone.
ICOMATDCommand Interface
public interface ICOMATDCommand { string CallerId { get; } void AnswerMobileCall(); void EndMobileCall(); void MakeMobileCall(string CallerId); void MuteMobileCall(bool bMute); // Not Supported void Redial(); void RequestMobileCallStatus(); }
String CallerId{ get; }
CallerId property returns the Mobile phone caller ID. Initially, the CallerId will be an empty string and while on an incoming/active call calling RequestMobileCallStatus() will request the mobile call status and populate the CallerId based on the response from the device. CallerId when there is no active call will return the last calls CallerId which can be use to redial using MakeMobileCall().
bool AnswerMobileCall()
AnswerMobileCall() will answer an incoming mobile call when a multipoint BT dongle or base is paired with a headset and a mobile phone.
bool EndMobileCall()
EndMobileCall() will end a mobile call when a multipoint BT dongle or base is paired with a headset and a mobile phone. This method can be used to reject an incoming mobile call.
bool MakeMobileCall(String CallerId)
MakeMobileCall() will dial the given caller using the mobile phone when a multipoint BT dongle or base is paired with a headset and a mobile phone.
bool Redial()
Redial() will dial the last # dialed using the mobile phone when a multipoint BT dongle or base is paired with a headset and a mobile phone.
bool RequestMobileCallStatus()
RequestMobileCallStatus() will report the current mobile status via the PresenceChanged and the ATDStateChanged event.
bool MuteMobileCall(bool bMute)
MuteMobileCall() is used to MUTE or UnMUTE a mobile phone call when a multipoint BT dongle or base is paired with a headset and a mobile phone. This API is currently not supported.
ICOMMobilePresenceEvents Interface
public interface ICOMMobilePresenceEvents { void onPresenceChanged(COMMobilePresenceEventArgs args); }
IDeviceListenerEvents Interface
public interface IDeviceListenerEvents { //Headset : Covers Corded, Cordless headsets events event DeviceListenerEventHandler HeadsetButtonPressed; event DeviceListenerEventHandler HeadsetStateChanged; //Base: Covers Base, Hub, Handset events event DeviceListenerEventHandler BaseButtonPressed; event DeviceListenerEventHandler BaseStateChanged; //ATD: Covers Mobile, PSTN and other ATD events event DeviceListenerEventHandler ATDStateChanged; }
Code snippets:
Sample 1: Registering for Mobile Presence:
static ICOMATDCommand _atdCommand; static ICOMMobilePresenceEvents_Event _mobileEvents; private static COMDevice _device; static void Main() { //Get a valid _device COMSessionManager mgr = new COMSessionManager(); COMSession sess; mgr.Register("My Session", out sess); _device = sess.GetActiveDevice(); //Cast HostCommand and init _atdCommand and _mobileEvents _atdCommand = _device.HostCommand as ICOMATDCommand; _mobileEvents = _device as ICOMMobilePresenceEvents_Event; if (_mobileEvents != null) _mobileEvents.onPresenceChanged += mobileEvents_PresenceChanged; } private static void mobileEvents_PresenceChanged(COMMobilePresenceEventArgs args) { StringBuilder strB = new StringBuilder(); strB.Append("Mobile Presence: "); if (args.MobileCallState == DeviceMobileCallState.MobileCallState_CallerID) strB.Append(String.Format("{0} = {1}", args.MobileCallState, args.CallerId)); else strB.Append(String.Format("{0}", args.MobileCallState)); strB.Append(String.Format(" ( {0} )", DateTime.Now.TimeOfDay)); strB.AppendLine(); Console.WriteLine(strB.ToString()); }
Sample 2: Make call using mobile phone
private static void MakeMobileCall() { try { if (_atdCommand != null) _atdCommand.MakeMobileCall(number); } catch (COMException e) { Console.WriteLine(e.ToString()); } }
Sample 3: Redial using CallerId
private static void MobileRedial() { try { if (_atdCommand != null) { if (_atdCommand.CallerId != String.Empty) _atdCommand.MakeMobileCall(_atdCommand.CallerId); } } catch (COMException e) { Console.WriteLine(e.ToString()); } }
Download link: Plantronics Mobile Caller ID Sample.zip