Hi All,
Adding Plantronics support to your app is as easy as this!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Plantronics.UC.SpokesWrapper;
namespace SpokesQuickStartDemo
{
class Program
{
static Spokes spokes;
static void Main(string[] args)
{
spokes = Spokes.Instance;
spokes.PutOn += spokes_PutOn;
spokes.TakenOff += spokes_TakenOff;
spokes.Connect("Spokes Quick Start");
Console.WriteLine("Press enter to quit...");
Console.ReadLine();
spokes.PutOn -= spokes_PutOn;
spokes.TakenOff -= spokes_TakenOff;
spokes.Disconnect();
}
static void spokes_TakenOff(object sender, WearingStateArgs e)
{
Console.WriteLine("Headset is not worn");
}
static void spokes_PutOn(object sender, WearingStateArgs e)
{
Console.WriteLine("Headset is worn");
}
}
}
The above command line application will show you when the headset is put on and taken off, like this:
Background info
The Plantronics Spokes SDK contains all you need to integrate support into your app for Plantronics headset, speaker and multiline devices.
Spokes is a software runtime that talks to the Plantronics device on your behalf and exposes a set of APIs to program the device. Read more.
Spokes 2.7 has 3 main APIs:
- COM Service, being a Win32 COM interface typically used from C++ apps
- .NET Interop for COM Service, allowing C#/VB.NET apps to connect to above COM Service
- REST Service, being a web service offering access to Spokes from language of your choice via HTTP requests
Note: iPlugin API will not be available in next major Spokes release. If you are using it you need to migrate to COM Service or .NET Interop for COM Service / SpokesWrapper.cs.
More detail: Integrate to Spokes in 5-minutes (or less)!
- Install Spokes software from Plantronics | Support | Downloads & Apps | Plantronics (don't bother with the SDK yet, you don't need for this quick-start)
- Launch Visual Studio
- Choose File | New | Project
- Choose Visual C# | Windows | .NET Framework 4 | Console Application (must be .NET 4 or higher to use Spokes C# API)
- In the Solution Explorer in the project References, right-click and Add Reference:
- Navigate to the Spoke runtime folder: C:\Program Files (x86)\Plantronics\PlantronicsURE, and select Interop.Plantronics.dll
- Right click on the reference in the project and choose properties, and set Embed Interop Types to False:
- Now download a copy of SpokesWrapper.cs, a source file that does a lot of hard work for you!
- Right click on project in Solution Explorer and click Add Existing Item
- Navigate to the location of the SpokesWrapper.cs file you just downloaded and click Add. This should now be added to your project in Solution Explorer.
- You can now write your program code like the sample at the top of this blog!
- Visual Studio project is attached below...
- For a more comprehensive sample using the wrapper please refer to the Spokes Easy Demo.
- This demo includes softphone call control, mobile call control / mobile caller id, multi-line control, serial numbers as well as status of: wearing sensor, proximity, docking, softphone calling, mobile calling, mute and multi-line.
Have fun! See you soon ...
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.