Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

A nice bit of kit - the Blackwire C720, let's integrate into your UC app!

17 Jan 2013 1  
In this post I want to show you how to get started with this feature from scratch!

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

 

The Blackwire C720, the recently launched stereo version of the Blackwire 700 Series of wired/wireless combined headsets from Plantronics is a nice bit of kit, with cool features like wireless mobile calling via the Bluetooth belt clip unit, not to mention high quality A2DP music streamed wirelessly from your mobile device while you work!

For developers it allows you to integrate to your UC application's presence feature by making use of the wearing sensor state reported from the headset.

In this post I want to show you how to get started with this feature from scratch!

1. Install the Spokes SDK

  • Head on over to the PDC web site home page: Welcome | Plantronics Developer Connection
  • Hit the orange Download the SDK button, and download the ZIP file
  • Run the PlantronicsURE-SDK.msi file and install it (note, if you have other Spokes product installed you should remove that first via Control Panel\Programs and Features)
  • You are now ready to integrate your app to Plantronics!

2. Add Spokes SDK References to your app!

  • If you don't have an app yet, don't worry, let's make a test one...
    • This article assumes your app is written in C# and targets .NET 4, 4.5 or later. (Other language samples available on our site in DevZone)
    • A sample project for this article can be downloaded at the bottom of the article.
    • Go into Visual Studio 2008 / 2010 / 2012
    • Click File | New | Project
      • Choose C# Windows Forms Application, give it a Name, e.g. My UC App, then press OK
      • Once it finishes chuntering away, press F5
      • Woohoo, we have an app!
      • Ok, ok, it doesn't talk to the headset... I was coming to that part!
      • In the Solution explorer for your app, right click References | Add Reference...
      • Choose Browse, and head on over to Plantronics SDK folder. Choose the Interop.Plantronics.dll
        This is the C# Interop DLL for the Spokes COM Service API. Click Add
      • Once added right click the reference and Properties. Ensure Embed Interop Types is set to False, and Copy Local set to True:
      • Ok, good job - we are ready to use the Spokes API in our app!

3. Add couple of labels to the GUI

  • Let's add something to our GUI so we can show the wearing state:
  • Rename the 2nd label to wearingStateLbl:

4. Initialise connection to the Spokes SDK

  • Lets add some code to initialise the SDK. This relies on a pre-built sample code file called "Spokes.cs" that you can download at end of this article. **Please add this file to the project before continuing...** then:
  • Right-click the Form1.cs and View Code:
  • Add a Spokes member variable to your Form1 class, as follows:
      Spokes m_spokes = null;
  • In your Form1() constructor, after InitializeComponent() add these 3 lines:
            m_spokes = Spokes.Instance;
            m_spokes.RegisterSpokesHandlerHWnd(this.Handle);
            m_spokes.GetInitialDonnedStatus();
  • In Form1 provide an override for the DefWndProc. The Spokes object will post headset events to your form using Windows events, which you can handle like this:
protected override void DefWndProc(ref Message msg)
{
    switch (msg.Msg)
    {
        case (int)SpokesWM.DEVICE_DON:
            wearingStateLbl.Text = "It is being worn";
            break;
        case (int)SpokesWM.DEVICE_DOFF:
            wearingStateLbl.Text = "It is NOT being worn";
            break;
        default:
            base.DefWndProc(ref msg);
            break;
    };
}

5. And test it!

  • Run the application
  • Put on your headset:
  • Take off your headset:
  • Yay! You have integrated Plantronics presence sensor technology to your app!

Have fun!

See above for the Spokes.cs sample file to include in your app, and a ZIP file containing full sample project.

This article was written by Lewis Collins. Lewis became a member of the Plantronics Engineering team in August 2011. In this role he provides software consulting and expertise internally across teams and to external development partners who want to integrate with the Plantronics SDK kits and headset products. Previously Lewis gained experience in a wide range of software engineering activities and technologies, working in the telecommunications and public safety sectors as a software engineer at Integraph, a consultant for Altran Technologies UK and as a software engineer for Teleca Ltd.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here