The new version of the Microsoft Band SDK, version 1.3.10518, was released on May 21, 2015 and allows developers to play around with the Microsoft Band. The SDK gives developers access to the sensors available on the Band as well as the ability to create Tiles on the Band.
The new SDK includes the following:
- Multi-Platform support.
- Sensor data subscription.
- Tile creation and management.
- Tile Notification.
- Custom layouts.
- Haptic notification.
- Band theme personalization.
Overview of Microsoft Band
Figure 1: Microsoft Band
Microsft Band is a device worn as a bracelet with a Touchscreen display and sensors as in the following:
- Accelerometer sensor 3-axis(XYZ).
- Gyro meter sensor provide XYZ angular Velocity in degree.
- Optical hear rate sensor provides number of beats per minute.
- GPS
- Temperature Sensor
- UV sensor
- Capacitive sensor
- Galvanic Skin response*
- Ambient light sensor*
These are currently not accessible through the SDK.
The following image shows the axes for the gyrometer and accelerometer sensors.
Figure 2: Axes for gyrometer and accelerometer sensor
Requirements
For the Windows platform we require Visual Studio 2013 or higher to develop a Microsoft Band App. The Microsoft Band SDK latest version 1.3.10518 was released on May 21, 2015.
Procedure to install Microsoft SDK
Create a new Windows Phone or Windows Universal project. Here I have created a Windows Phone 8.1 project and selected Manage NuGet Packages as shown in the following screen.
Figure 3: Manage NuGet Packages
Now search for and install the Microsoft Band SDK as shown in the following screen.
Figure 4: Microsoft Band SDK
After installing the Microsoft SDK check that the Proximity capability has been added to the manifest file as in the following:
Figure 5: Proximity capability
Enable Proximity
Add the following code to the Package.appmanifest file. Right-click the appmainfest file and select View Code to add the code.
- <DeviceCapability Name="bluetooth.rfcomm" xmlns="http://schemas.microsoft.com/appx/2013/manifest">
- <Device Id="any">
- <Function Type="serviceId:A502CA9A-2BA5-413C-A4E0-13804E47B38F" />
- <Function Type="serviceId:C742E1A2-6320-5ABC-9643-D206C677E580" />
- </Device>
- </DeviceCapability>
The first step is to connect to the Band. To make the connection, the band and the device must be paired with Bluetooth. To get the paired Band and establish a connection use the Band Client Manager.
First add the namespace as in the following:
Next get the list of paired Bands using the following code.
- IBandInfo[] getPairedDevice=await BandClientManager.Instance.GetBandsAsync();
Connect to the band.
- using(IBandClient client=await BandClientManager.Instance.ConnectAsync(getPairedDevice[0]))
- {
-
- }
In this sample I will get the Band firmware version and hardware version.
The following is the code to get the band version.
- using(IBandClient client=await BandClientManager.Instance.ConnectAsync(getPairedDevice[0]))
- {
- string bandVersion = await client.GetFirmwareVersionAsync();
- string bandHWversion = await client.GetHardwareVersionAsync();
- }