Skip to content

Commit

Permalink
Added some documentation to the portableAPI:
Browse files Browse the repository at this point in the history
 - Microsoft.Band.Portable
 - Microsoft.Band.Portable.Notifications
  • Loading branch information
mattleibow committed May 5, 2015
1 parent e895b95 commit ff22bf4
Show file tree
Hide file tree
Showing 7 changed files with 162 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

namespace Microsoft.Band.Portable
{
/// <summary>
/// Provides access to paired Band devices and the ability to connect to them.
/// </summary>
public class BandClientManager
{
private static Lazy<BandClientManager> instance;
Expand All @@ -23,11 +26,21 @@ static BandClientManager()
instance = new Lazy<BandClientManager>(() => new BandClientManager());
}

/// <summary>
/// Gets the value representing the current instance of the client manager.
/// </summary>
/// <value>
/// The current instance of the client manager.
/// </value>
public static BandClientManager Instance
{
get { return instance.Value; }
}

/// <summary>
/// Returns a collection of the Band devices that are paired with the current device.
/// </summary>
/// <returns>A collection of the paired Bands.</returns>
public async Task<IEnumerable<BandDeviceInfo>> GetPairedBandsAsync()
{
#if __ANDROID__
Expand All @@ -41,6 +54,12 @@ public async Task<IEnumerable<BandDeviceInfo>> GetPairedBandsAsync()
#endif
}

/// <summary>
/// Connects to the Band device specified by the device information,
/// and returns a client that is used for communication.
/// </summary>
/// <param name="info">The Band device information to connect to.</param>
/// <returns>The client instance that is used to communicate with the connected Band device.</returns>
public async Task<BandClient> ConnectAsync(BandDeviceInfo info)
{
#if __ANDROID__
Expand Down
44 changes: 44 additions & 0 deletions Microsoft.Band.Portable/Microsoft.Band.Portable/IBandClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@

namespace Microsoft.Band.Portable
{
/// <summary>
/// Represents a connected Band device.
/// </summary>
public class BandClient
{
private readonly Lazy<BandSensorManager> sensors;
Expand All @@ -46,6 +49,12 @@ internal BandClient(NativeBandClient client)
}
#endif

/// <summary>
/// Gets the value representing the current instance of the sensor manager.
/// </summary>
/// <value>
/// The current instance of the sensor manager.
/// </value>
public BandSensorManager SensorManager
{
get
Expand All @@ -56,6 +65,12 @@ public BandSensorManager SensorManager
}
}

/// <summary>
/// Gets the value representing the current instance of the notification manager.
/// </summary>
/// <value>
/// The current instance of the notification manager.
/// </value>
public BandNotificationManager NotificationManager
{
get
Expand All @@ -66,6 +81,12 @@ public BandNotificationManager NotificationManager
}
}

/// <summary>
/// Gets the value representing the current instance of the tile manager.
/// </summary>
/// <value>
/// The current instance of the tile manager.
/// </value>
public BandTileManager TileManager
{
get
Expand All @@ -76,6 +97,12 @@ public BandTileManager TileManager
}
}

/// <summary>
/// Gets the value representing the current instance of the personalization manager.
/// </summary>
/// <value>
/// The current instance of the personalization manager.
/// </value>
public BandPersonalizationManager PersonalizationManager
{
get
Expand All @@ -86,6 +113,12 @@ public BandPersonalizationManager PersonalizationManager
}
}

/// <summary>
/// Gets a value indicating whether this instance is connected to a Band device.
/// </summary>
/// <value>
/// <c>true</c> if this instance is connected to a Band device; otherwise, <c>false</c>.
/// </value>
public bool IsConnected
{
get
Expand All @@ -102,6 +135,10 @@ public bool IsConnected
}
}

/// <summary>
/// Returns the firmware version of the Band.
/// </summary>
/// <returns>A string representing the firmware version of the Band.</returns>
public async Task<string> GetFirmwareVersionAsync()
{
CheckDisposed();
Expand All @@ -117,6 +154,10 @@ public async Task<string> GetFirmwareVersionAsync()
#endif
}

/// <summary>
/// Returns the hardware version of the Band.
/// </summary>
/// <returns>A string representing the hardware version of the Band.</returns>
public async Task<string> GetHardwareVersionAsync()
{
CheckDisposed();
Expand All @@ -132,6 +173,9 @@ public async Task<string> GetHardwareVersionAsync()
#endif
}

/// <summary>
/// Disconnects from the current Band device.
/// </summary>
public async Task DisconnectAsync()
{
CheckDisposed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

namespace Microsoft.Band.Portable
{
/// <summary>
/// Represents a paired device.
/// </summary>
public class BandDeviceInfo
{
#if __ANDROID__ || __IOS__ || WINDOWS_PHONE_APP
Expand All @@ -20,6 +23,12 @@ internal BandDeviceInfo(NativeBandDeviceInfo info)
}
#endif

/// <summary>
/// Gets the name of the Band device this instance represents.
/// </summary>
/// <value>
/// The name of the Band device.
/// </value>
public string Name
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

namespace Microsoft.Band.Portable.Notifications
{
/// <summary>
/// Represents the notification manager for a connected Band device.
/// </summary>
public class BandNotificationManager
{
private readonly BandClient client;
Expand All @@ -23,16 +26,42 @@ internal BandNotificationManager(BandClient client, NativeBandNotificationManage
}
#endif

/// <summary>
/// Sends a message to a specific tile to the connected Band device with the provided tile ID, title,
/// body and timestamp.
/// </summary>
/// <param name="tileId">The tile identifier.</param>
/// <param name="title">The message title.</param>
/// <param name="body">The message body.</param>
/// <param name="timestamp">The message timestamp.</param>
public async Task SendMessageAsync(Guid tileId, string title, string body, DateTime timestamp)
{
await SendMessageAsync(tileId, title, body, timestamp, false);
}

/// <summary>
/// Sends a message to a specific tile to the connected Band device with the provided tile ID, title, body,
/// timestamp and, optionally, with a dialog.
/// </summary>
/// <param name="tileId">The tile identifier.</param>
/// <param name="title">The message title.</param>
/// <param name="body">The message body.</param>
/// <param name="timestamp">The message timestamp.</param>
/// <param name="showDialog">Display a dialog if set to <c>true</c>; otherwise, don't.</param>
public async Task SendMessageAsync(Guid tileId, string title, string body, DateTime timestamp, bool showDialog)
{
await SendMessageAsync(tileId, title, body, timestamp, showDialog ? MessageFlags.ShowDialog : MessageFlags.None);
}

/// <summary>
/// Sends a message to a specific tile to the connected Band device with the provided tile ID, title, body,
/// timestamp and with message flags to control how the message is provided.
/// </summary>
/// <param name="tileId">The tile identifier.</param>
/// <param name="title">The message title.</param>
/// <param name="body">The message body.</param>
/// <param name="timestamp">The message timestamp.</param>
/// <param name="messageFlags">The message flags to control how the message is provided to the Band device.</param>
public async Task SendMessageAsync(Guid tileId, string title, string body, DateTime timestamp, MessageFlags messageFlags)
{
#if __ANDROID__ || __IOS__
Expand All @@ -42,6 +71,12 @@ public async Task SendMessageAsync(Guid tileId, string title, string body, DateT
#endif
}

/// <summary>
/// Shows a dialog on the connected Band device.
/// </summary>
/// <param name="tileId">The tile identifier.</param>
/// <param name="title">The message title.</param>
/// <param name="body">The message body.</param>
public async Task ShowDialogAsync(Guid tileId, string title, string body)
{
#if __ANDROID__ || __IOS__
Expand All @@ -51,6 +86,10 @@ public async Task ShowDialogAsync(Guid tileId, string title, string body)
#endif
}

/// <summary>
/// Vibrates the connected Band device using the specified vibration type.
/// </summary>
/// <param name="vibrationType">Type of vibration to use.</param>
public async Task VibrateAsync(VibrationType vibrationType)
{
#if __ANDROID__ || __IOS__
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
namespace Microsoft.Band.Portable.Notifications
{
/// <summary>
/// Represents flags that control how a message is sent to a Band device.
/// </summary>
public enum MessageFlags
{
/// <summary>
/// Use the default message style.
/// </summary>
None,
/// <summary>
/// Show dialog when sending a message.
/// </summary>
ShowDialog
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,45 @@
namespace Microsoft.Band.Portable.Notifications
{
/// <summary>
/// Represents a type of vibration that can be sent to a Band device.
/// </summary>
public enum VibrationType
{
/// <summary>
/// The ramp down vibration type.
/// </summary>
RampDown,
/// <summary>
/// The ramp up vibration type.
/// </summary>
RampUp,
/// <summary>
/// The notification one-tone vibration type.
/// </summary>
NotificationOneTone,
/// <summary>
/// The notification two-tone vibration type.
/// </summary>
NotificationTwoTone,
/// <summary>
/// The notification alarm vibration type.
/// </summary>
NotificationAlarm,
/// <summary>
/// The notification timer vibration type.
/// </summary>
NotificationTimer,
/// <summary>
/// The one-tone high vibration type.
/// </summary>
OneToneHigh,
/// <summary>
/// The three-tone high vibration type.
/// </summary>
ThreeToneHigh,
/// <summary>
/// The two-tone high vibration type.
/// </summary>
TwoToneHigh
}
}
12 changes: 12 additions & 0 deletions Microsoft.Band.Portable/Microsoft.Band.Portable/UserConsent.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
namespace Microsoft.Band.Portable
{
/// <summary>
/// Represents the result of a request for user consent.
/// </summary>
public enum UserConsent
{
/// <summary>
/// The user declined consent.
/// </summary>
Declined,
/// <summary>
/// The user granted consent.
/// </summary>
Granted,
/// <summary>
/// The user has not yet reponded to a request.
/// </summary>
Unspecified
}
}

0 comments on commit ff22bf4

Please sign in to comment.