Quantcast
Channel: PDC Blogs
Viewing all articles
Browse latest Browse all 26

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

$
0
0

blackwire-720.gifThe 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!
        my uc app 1.png
      • 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...
        add reference.png
      • 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
        add reference 2.png
      • Once added right click the reference and Properties. Ensure Embed Interop Types is set to False, and Copy Local set to True:
        add reference 3.png
      • 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:
    add a couple of labels.png
  • Rename the 2nd label to wearingStateLbl:
    rename label2.png

 

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:
    View Code.png
  • 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:
    headset worn.png
  • Take off your headset:
    headset not worn.png
  • Yay! You have integrated Plantronics presence sensor technology to your app!

 

Have fun!

 

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


Viewing all articles
Browse latest Browse all 26

Trending Articles