├── src ├── .nuget │ ├── NuGet.exe │ └── NuGet.Config ├── Samples │ ├── P3bble │ │ ├── Assets │ │ │ ├── Logo.png │ │ │ ├── BadgeLogo.png │ │ │ ├── StoreLogo.png │ │ │ ├── WideLogo.png │ │ │ ├── SplashScreen.png │ │ │ ├── AlignmentGrid.png │ │ │ ├── ApplicationIcon.png │ │ │ ├── SquareTile150x150.png │ │ │ ├── SquareTile71x71.png │ │ │ └── Tiles │ │ │ │ ├── IconicTileSmall.png │ │ │ │ ├── FlipCycleTileLarge.png │ │ │ │ ├── FlipCycleTileSmall.png │ │ │ │ ├── FlipCycleTileMedium.png │ │ │ │ └── IconicTileMediumLarge.png │ │ ├── Properties │ │ │ ├── AppManifest.xml │ │ │ ├── AssemblyInfo.cs │ │ │ └── WMAppManifest.xml │ │ ├── packages.config │ │ ├── LocalizedStrings.cs │ │ ├── App.xaml │ │ ├── XNAFrameworkDispatcherService.cs │ │ ├── Package.appxmanifest │ │ ├── MainPage.xaml │ │ └── Resources │ │ │ ├── AppResources.Designer.cs │ │ │ └── AppResources.resx │ ├── P3bble-S8.1 │ │ ├── Assets │ │ │ ├── Logo.png │ │ │ ├── BadgeLogo.png │ │ │ ├── StoreLogo.png │ │ │ ├── WideLogo.png │ │ │ ├── SplashScreen.png │ │ │ ├── AlignmentGrid.png │ │ │ ├── ApplicationIcon.png │ │ │ ├── SquareTile150x150.png │ │ │ ├── SquareTile71x71.png │ │ │ └── Tiles │ │ │ │ ├── IconicTileSmall.png │ │ │ │ ├── FlipCycleTileLarge.png │ │ │ │ ├── FlipCycleTileSmall.png │ │ │ │ ├── FlipCycleTileMedium.png │ │ │ │ └── IconicTileMediumLarge.png │ │ ├── Properties │ │ │ ├── AppManifest.xml │ │ │ ├── AssemblyInfo.cs │ │ │ └── WMAppManifest.xml │ │ ├── packages.config │ │ ├── LocalizedStrings.cs │ │ ├── App.xaml │ │ ├── XNAFrameworkDispatcherService.cs │ │ ├── Package.appxmanifest │ │ ├── MainPage.xaml │ │ └── Resources │ │ │ ├── AppResources.Designer.cs │ │ │ └── AppResources.resx │ ├── P3bbleWinRT │ │ ├── Assets │ │ │ ├── Logo.png │ │ │ ├── SmallLogo.png │ │ │ ├── StoreLogo.png │ │ │ └── SplashScreen.png │ │ ├── P3bbleWinRT_TemporaryKey.pfx │ │ ├── packages.config │ │ ├── App.xaml │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Package.appxmanifest │ │ ├── MainPage.xaml │ │ ├── App.xaml.cs │ │ ├── P3bbleWinRT.sln │ │ └── MessageBox.cs │ └── P3bble-8.1 │ │ ├── Assets │ │ ├── Logo.scale-240.png │ │ ├── WideLogo.scale-240.png │ │ ├── SmallLogo.scale-240.png │ │ ├── StoreLogo.scale-240.png │ │ ├── SplashScreen.scale-240.png │ │ └── Square71x71Logo.scale-240.png │ │ ├── App.xaml │ │ ├── MessageBox.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Package.appxmanifest │ │ ├── MainPage.xaml │ │ └── App.xaml.cs ├── packages │ └── repositories.config ├── P3bble.Core │ ├── Constants │ │ ├── MusicControls.cs │ │ ├── SessionCaps.cs │ │ ├── HardwareRevision.cs │ │ ├── RemoteCaps.cs │ │ └── Endpoint.cs │ ├── packages.config │ ├── Exceptions │ │ ├── NotConnectedException.cs │ │ ├── CannotInstallException.cs │ │ └── ProtocolException.cs │ ├── Messages │ │ ├── ResetMessage.cs │ │ ├── PingMessage.cs │ │ ├── PhoneVersionMessage.cs │ │ ├── VersionMessage.cs │ │ ├── NotificationMessage.cs │ │ ├── TimeMessage.cs │ │ ├── MusicMessage.cs │ │ ├── SystemMessage.cs │ │ ├── PhoneControlMessage.cs │ │ ├── LogsMessage.cs │ │ ├── P3bbleMessage.cs │ │ └── AppMessage.cs │ ├── Types │ │ ├── MusicControlAction.cs │ │ ├── FirmwareResponse.cs │ │ ├── InstalledApplication.cs │ │ ├── ResourcesManifest.cs │ │ ├── InstalledApplications.cs │ │ ├── BundleManifest.cs │ │ ├── FirmwareRelease.cs │ │ ├── ApplicationManifest.cs │ │ ├── FirmwareManifest.cs │ │ ├── FirmwareVersion.cs │ │ ├── ApplicationMetadata.cs │ │ └── VersionInfo.cs │ ├── Helper │ │ ├── ByteHelper.cs │ │ └── Util.cs │ ├── AsyncLock.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── Logger.cs ├── P3bble.Core-8.1 │ ├── packages.config │ ├── Logger.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── P3bble.Core-S8.1 │ ├── packages.config │ └── Properties │ │ └── AssemblyInfo.cs ├── P3bbleWinRT.Core │ ├── packages.config │ ├── Logger.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── P3bble.PCL │ ├── Logger │ │ └── BaseLogger.cs │ ├── ServiceLocator.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── P3bble.PCL.csproj ├── Settings.StyleCop ├── P3bble-S8.1.sln ├── P3bbleWinRT.sln ├── P3bble.sln └── P3bble-8.1.sln ├── .gitattributes ├── NuGet ├── P3bble.PCL.nuspec ├── P3bble.nuspec └── Package.ps1 ├── .gitignore ├── LICENSE.txt └── README.md /src/.nuget/NuGet.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/.nuget/NuGet.exe -------------------------------------------------------------------------------- /src/Samples/P3bble/Assets/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble/Assets/Logo.png -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Assets/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-S8.1/Assets/Logo.png -------------------------------------------------------------------------------- /src/Samples/P3bble/Assets/BadgeLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble/Assets/BadgeLogo.png -------------------------------------------------------------------------------- /src/Samples/P3bble/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble/Assets/StoreLogo.png -------------------------------------------------------------------------------- /src/Samples/P3bble/Assets/WideLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble/Assets/WideLogo.png -------------------------------------------------------------------------------- /src/Samples/P3bbleWinRT/Assets/Logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bbleWinRT/Assets/Logo.png -------------------------------------------------------------------------------- /src/Samples/P3bble/Assets/SplashScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble/Assets/SplashScreen.png -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Assets/BadgeLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-S8.1/Assets/BadgeLogo.png -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-S8.1/Assets/StoreLogo.png -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Assets/WideLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-S8.1/Assets/WideLogo.png -------------------------------------------------------------------------------- /src/Samples/P3bble/Assets/AlignmentGrid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble/Assets/AlignmentGrid.png -------------------------------------------------------------------------------- /src/Samples/P3bbleWinRT/Assets/SmallLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bbleWinRT/Assets/SmallLogo.png -------------------------------------------------------------------------------- /src/Samples/P3bbleWinRT/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bbleWinRT/Assets/StoreLogo.png -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Assets/SplashScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-S8.1/Assets/SplashScreen.png -------------------------------------------------------------------------------- /src/Samples/P3bble/Assets/ApplicationIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble/Assets/ApplicationIcon.png -------------------------------------------------------------------------------- /src/Samples/P3bble/Assets/SquareTile150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble/Assets/SquareTile150x150.png -------------------------------------------------------------------------------- /src/Samples/P3bble/Assets/SquareTile71x71.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble/Assets/SquareTile71x71.png -------------------------------------------------------------------------------- /src/Samples/P3bbleWinRT/Assets/SplashScreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bbleWinRT/Assets/SplashScreen.png -------------------------------------------------------------------------------- /src/Samples/P3bble-8.1/Assets/Logo.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-8.1/Assets/Logo.scale-240.png -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Assets/AlignmentGrid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-S8.1/Assets/AlignmentGrid.png -------------------------------------------------------------------------------- /src/Samples/P3bble-8.1/Assets/WideLogo.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-8.1/Assets/WideLogo.scale-240.png -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Assets/ApplicationIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-S8.1/Assets/ApplicationIcon.png -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Assets/SquareTile150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-S8.1/Assets/SquareTile150x150.png -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Assets/SquareTile71x71.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-S8.1/Assets/SquareTile71x71.png -------------------------------------------------------------------------------- /src/Samples/P3bble/Assets/Tiles/IconicTileSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble/Assets/Tiles/IconicTileSmall.png -------------------------------------------------------------------------------- /src/Samples/P3bbleWinRT/P3bbleWinRT_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bbleWinRT/P3bbleWinRT_TemporaryKey.pfx -------------------------------------------------------------------------------- /src/Samples/P3bble-8.1/Assets/SmallLogo.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-8.1/Assets/SmallLogo.scale-240.png -------------------------------------------------------------------------------- /src/Samples/P3bble-8.1/Assets/StoreLogo.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-8.1/Assets/StoreLogo.scale-240.png -------------------------------------------------------------------------------- /src/Samples/P3bble/Assets/Tiles/FlipCycleTileLarge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble/Assets/Tiles/FlipCycleTileLarge.png -------------------------------------------------------------------------------- /src/Samples/P3bble/Assets/Tiles/FlipCycleTileSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble/Assets/Tiles/FlipCycleTileSmall.png -------------------------------------------------------------------------------- /src/Samples/P3bble-8.1/Assets/SplashScreen.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-8.1/Assets/SplashScreen.scale-240.png -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Assets/Tiles/IconicTileSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-S8.1/Assets/Tiles/IconicTileSmall.png -------------------------------------------------------------------------------- /src/Samples/P3bble/Assets/Tiles/FlipCycleTileMedium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble/Assets/Tiles/FlipCycleTileMedium.png -------------------------------------------------------------------------------- /src/Samples/P3bble/Assets/Tiles/IconicTileMediumLarge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble/Assets/Tiles/IconicTileMediumLarge.png -------------------------------------------------------------------------------- /src/Samples/P3bble-8.1/Assets/Square71x71Logo.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-8.1/Assets/Square71x71Logo.scale-240.png -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Assets/Tiles/FlipCycleTileLarge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-S8.1/Assets/Tiles/FlipCycleTileLarge.png -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Assets/Tiles/FlipCycleTileSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-S8.1/Assets/Tiles/FlipCycleTileSmall.png -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Assets/Tiles/FlipCycleTileMedium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-S8.1/Assets/Tiles/FlipCycleTileMedium.png -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Assets/Tiles/IconicTileMediumLarge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/p3root/P3bble/HEAD/src/Samples/P3bble-S8.1/Assets/Tiles/IconicTileMediumLarge.png -------------------------------------------------------------------------------- /src/.nuget/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Samples/P3bble/Properties/AppManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Samples/P3bble-8.1/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Properties/AppManifest.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Samples/P3bble/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Samples/P3bbleWinRT/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/packages/repositories.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/P3bble.Core/Constants/MusicControls.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace P3bble.Core.Constants 8 | { 9 | public enum MusicControls 10 | { 11 | PlayPause = 1, 12 | Forward = 4, 13 | Previous = 5, 14 | // PlayPause also sends 8 for some reason. To be figured out. 15 | Other = 8 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Samples/P3bble/LocalizedStrings.cs: -------------------------------------------------------------------------------- 1 | using P3bble.Resources; 2 | 3 | namespace P3bble 4 | { 5 | /// 6 | /// Provides access to string resources. 7 | /// 8 | public class LocalizedStrings 9 | { 10 | private static AppResources _localizedResources = new AppResources(); 11 | 12 | public AppResources LocalizedResources { get { return _localizedResources; } } 13 | } 14 | } -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/LocalizedStrings.cs: -------------------------------------------------------------------------------- 1 | using P3bble.Resources; 2 | 3 | namespace P3bble 4 | { 5 | /// 6 | /// Provides access to string resources. 7 | /// 8 | public class LocalizedStrings 9 | { 10 | private static AppResources _localizedResources = new AppResources(); 11 | 12 | public AppResources LocalizedResources { get { return _localizedResources; } } 13 | } 14 | } -------------------------------------------------------------------------------- /src/P3bble.Core/Constants/SessionCaps.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace P3bble.Constants 8 | { 9 | /// 10 | /// Session capabilities 11 | /// 12 | internal enum SessionCaps : uint 13 | { 14 | /// 15 | /// Gamma ray 16 | /// 17 | GammaRay = 0x80000000 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/P3bble.Core/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/P3bble.Core-8.1/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/P3bble.Core-S8.1/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/P3bbleWinRT.Core/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/Samples/P3bble-8.1/MessageBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Windows.UI.Popups; 7 | 8 | namespace P3bble 9 | { 10 | public static class MessageBox 11 | { 12 | public static async void Show(string message) 13 | { 14 | MessageDialog messageDialog = new MessageDialog(message); 15 | await messageDialog.ShowAsync(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/P3bble.Core/Exceptions/NotConnectedException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace P3bble 4 | { 5 | /// 6 | /// Raised when calling a method on an unconnected Pebble 7 | /// 8 | public class NotConnectedException : Exception 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | public NotConnectedException() 14 | : base("You first need to connect to the Pebble") 15 | { 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | *.sln merge=union 7 | *.csproj merge=union 8 | *.vbproj merge=union 9 | *.fsproj merge=union 10 | *.dbproj merge=union 11 | 12 | # Standard to msysgit 13 | *.doc diff=astextplain 14 | *.DOC diff=astextplain 15 | *.docx diff=astextplain 16 | *.DOCX diff=astextplain 17 | *.dot diff=astextplain 18 | *.DOT diff=astextplain 19 | *.pdf diff=astextplain 20 | *.PDF diff=astextplain 21 | *.rtf diff=astextplain 22 | *.RTF diff=astextplain 23 | -------------------------------------------------------------------------------- /src/P3bble.Core/Messages/ResetMessage.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using P3bble.Constants; 3 | 4 | namespace P3bble.Messages 5 | { 6 | internal class ResetMessage : P3bbleMessage 7 | { 8 | public ResetMessage() 9 | : base(Endpoint.Reset) 10 | { 11 | } 12 | 13 | protected override void AddContentToMessage(List payload) 14 | { 15 | payload.Add(0x00); 16 | } 17 | 18 | protected override void GetContentFromMessage(List payload) 19 | { 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/P3bbleWinRT.Core/Logger.cs: -------------------------------------------------------------------------------- 1 | using P3bble.PCL; 2 | using P3bble.PCL.Logger; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Diagnostics; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace P3bble 11 | { 12 | public class Logger : BaseLogger 13 | { 14 | public override void WriteLine(string message) 15 | { 16 | Debug.WriteLine(message); 17 | } 18 | 19 | public override void ClearUp() 20 | { 21 | // throw new NotImplementedException(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/P3bble.Core/Exceptions/CannotInstallException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace P3bble 4 | { 5 | /// 6 | /// Raised when trying to install an app when there is no space 7 | /// 8 | public class CannotInstallException : Exception 9 | { 10 | /// 11 | /// Initializes a new instance of the class. 12 | /// 13 | /// The message that describes the error. 14 | public CannotInstallException(string message) 15 | : base(message) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/P3bble.PCL/Logger/BaseLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace P3bble.PCL.Logger 7 | { 8 | public class BaseLogger 9 | { 10 | 11 | public virtual void WriteLine(string message) { } 12 | public virtual void ClearUp() { } 13 | 14 | /// 15 | /// Gets or sets a value indicating whether logging is enabled. 16 | /// 17 | /// 18 | /// true if logging is enabled; otherwise, false. 19 | /// 20 | public bool IsEnabled { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/P3bble.Core/Types/MusicControlAction.cs: -------------------------------------------------------------------------------- 1 | namespace P3bble.Types 2 | { 3 | /// 4 | /// The music control action 5 | /// 6 | public enum MusicControlAction : byte 7 | { 8 | /// 9 | /// Unknown state 10 | /// 11 | Unknown = 0, 12 | 13 | /// 14 | /// Play or Pause 15 | /// 16 | PlayPause = 1, 17 | 18 | /// 19 | /// Skip next 20 | /// 21 | Next = 4, 22 | 23 | /// 24 | /// Skip previous 25 | /// 26 | Previous = 5 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/P3bble.PCL/ServiceLocator.cs: -------------------------------------------------------------------------------- 1 | using P3bble.PCL.Logger; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace P3bble.PCL 9 | { 10 | public class ServiceLocator 11 | { 12 | private static BaseLogger _logger; 13 | public static BaseLogger Logger 14 | { 15 | get 16 | { 17 | if (_logger == null) 18 | _logger = new BaseLogger(); 19 | return _logger; 20 | 21 | } 22 | set 23 | { 24 | _logger = value; 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/P3bble.Core/Helper/ByteHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace P3bble.Helper 8 | { 9 | internal class ByteHelper 10 | { 11 | public static byte[] ConvertToByteArray(int value) 12 | { 13 | return BitConverter.GetBytes(value); 14 | } 15 | 16 | public static byte[] ConvertToByteArray(uint value) 17 | { 18 | return BitConverter.GetBytes(value); 19 | } 20 | 21 | public static byte[] ConvertToByteArray(ushort value) 22 | { 23 | return BitConverter.GetBytes(value); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/P3bble.Core/Exceptions/ProtocolException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using P3bble.Messages; 3 | 4 | namespace P3bble 5 | { 6 | /// 7 | /// Raised when there's a protocol error 8 | /// 9 | public class ProtocolException : Exception 10 | { 11 | /// 12 | /// Initializes a new instance of the class. 13 | /// 14 | /// The log message. 15 | internal ProtocolException(LogsMessage logMessage) 16 | : base(logMessage.Message) 17 | { 18 | this.LogMessage = logMessage; 19 | } 20 | 21 | internal LogsMessage LogMessage { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Samples/P3bbleWinRT/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/P3bble.Core-8.1/Logger.cs: -------------------------------------------------------------------------------- 1 | using P3bble.PCL.Logger; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Diagnostics; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace P3bble.Core 10 | { 11 | /// 12 | public class Logger : BaseLogger 13 | { 14 | private string FileName { get; set; } 15 | 16 | /// 17 | /// Writes a line to the debug log. 18 | /// 19 | /// The message. 20 | public override void WriteLine(string message) 21 | { 22 | Debug.WriteLine(message); 23 | } 24 | 25 | /// 26 | /// Clears up the current log file. 27 | /// 28 | public override void ClearUp() 29 | { 30 | 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /NuGet/P3bble.PCL.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | P3bble.PCL 5 | 1.0.1.0 6 | P3bble 7 | Patrik Pfaffenbauer 8 | Patrik Pfaffenbauer 9 | https://raw.githubusercontent.com/p3root/P3bble/master/LICENSE.txt 10 | https://github.com/p3root/P3bble 11 | false 12 | P3bble.PCL is needed to use P3bble library. 13 | P3bble.PCL is needed to use P3bble library. 14 | en-US 15 | Copyright (c) 2013-2014 Patrik Pfaffenbauer 16 | Pebble WindowsPhone wp8 wp8.1 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/P3bble.Core/Constants/HardwareRevision.cs: -------------------------------------------------------------------------------- 1 | namespace P3bble.Types 2 | { 3 | /// 4 | /// Represents Pebble Hardware 5 | /// 6 | public enum HardwareRevision 7 | { 8 | /// 9 | /// The ev1 revision 10 | /// 11 | ev1 = 1, 12 | 13 | /// 14 | /// The ev2 revision 15 | /// 16 | ev2 = 2, 17 | 18 | /// 19 | /// The ev2_3 revision 20 | /// 21 | ev2_3 = 3, 22 | 23 | /// 24 | /// The ev2_4 revision 25 | /// 26 | ev2_4 = 4, 27 | 28 | /// 29 | /// The BB2 revision 30 | /// 31 | bb2 = 5, 32 | 33 | /// 34 | /// The bigboard revision 35 | /// 36 | bigboard = 6 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/P3bble.Core/Types/FirmwareResponse.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | using P3bble.Helper; 4 | 5 | namespace P3bble.Types 6 | { 7 | /// 8 | /// Represents firmware information from the cloud 9 | /// 10 | [DataContract] 11 | public class FirmwareResponse 12 | { 13 | /// 14 | /// Gets the recovery firmware version. 15 | /// 16 | /// 17 | /// The recovery firmware version. 18 | /// 19 | [DataMember(Name = "recovery")] 20 | public FirmwareRelease RecoveryFirmwareVersion { get; private set; } 21 | 22 | /// 23 | /// Gets the firmware version. 24 | /// 25 | /// 26 | /// The firmware version. 27 | /// 28 | [DataMember(Name = "normal")] 29 | public FirmwareRelease FirmwareVersion { get; private set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Samples/P3bble/App.xaml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/P3bble.Core/Messages/PingMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using P3bble.Constants; 4 | 5 | namespace P3bble.Messages 6 | { 7 | internal class PingMessage : P3bbleMessage 8 | { 9 | private byte[] _cookie; 10 | 11 | public PingMessage(byte[] cookie = null) 12 | : base(Endpoint.Ping) 13 | { 14 | if (cookie == null) 15 | { 16 | this._cookie = new byte[5] { 0x00, 0xEB, 0x00, 0x00, 0x00 }; 17 | } 18 | else 19 | { 20 | this._cookie = cookie; 21 | } 22 | } 23 | 24 | public uint Cookie { get; private set; } 25 | 26 | protected override void AddContentToMessage(List payload) 27 | { 28 | payload.AddRange(this._cookie); 29 | } 30 | 31 | protected override void GetContentFromMessage(List payload) 32 | { 33 | this.Cookie = BitConverter.ToUInt32(payload.ToArray(), 1); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/App.xaml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/P3bble.Core/Types/InstalledApplication.cs: -------------------------------------------------------------------------------- 1 | namespace P3bble.Types 2 | { 3 | /// 4 | /// Represents an installed application 5 | /// 6 | public class InstalledApplication 7 | { 8 | /// 9 | /// Gets the application id 10 | /// 11 | public uint Id { get; internal set; } 12 | 13 | /// 14 | /// Gets the application index 15 | /// 16 | public uint Index { get; internal set; } 17 | 18 | /// 19 | /// Gets the name 20 | /// 21 | public string Name { get; internal set; } 22 | 23 | /// 24 | /// Gets the company 25 | /// 26 | public string Company { get; internal set; } 27 | 28 | /// 29 | /// Gets the flags 30 | /// 31 | public uint Flags { get; internal set; } 32 | 33 | /// 34 | /// Gets the version 35 | /// 36 | public ushort Version { get; internal set; } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/P3bble.Core/Types/ResourcesManifest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | using P3bble.Helper; 4 | 5 | namespace P3bble.Types 6 | { 7 | /// 8 | /// Gets the details of bundle resources 9 | /// 10 | [DataContract] 11 | public class ResourcesManifest : VersionInfo 12 | { 13 | /// 14 | /// Gets the filename. 15 | /// 16 | /// 17 | /// The filename. 18 | /// 19 | [DataMember(Name = "name", IsRequired = true)] 20 | public string Filename { get; private set; } 21 | 22 | /// 23 | /// Gets the CRC. 24 | /// 25 | /// 26 | /// The CRC. 27 | /// 28 | [DataMember(Name = "crc", IsRequired = true)] 29 | public uint CRC { get; private set; } 30 | 31 | /// 32 | /// Gets the size. 33 | /// 34 | /// 35 | /// The size. 36 | /// 37 | [DataMember(Name = "size", IsRequired = true)] 38 | public int Size { get; private set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Samples/P3bble-8.1/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("P3bble8.1")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("P3bble8.1")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | // 24 | // You can specify all the values or you can default the Build and Revision Numbers 25 | // by using the '*' as shown below: 26 | // [assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /src/Samples/P3bble/XNAFrameworkDispatcherService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Threading; 4 | using Microsoft.Xna.Framework; 5 | 6 | namespace P3bble 7 | { 8 | public class XNAFrameworkDispatcherService : IApplicationService 9 | { 10 | private DispatcherTimer frameworkDispatcherTimer; 11 | 12 | public XNAFrameworkDispatcherService() 13 | { 14 | this.frameworkDispatcherTimer = new DispatcherTimer(); 15 | this.frameworkDispatcherTimer.Interval = TimeSpan.FromTicks(333333); 16 | this.frameworkDispatcherTimer.Tick += frameworkDispatcherTimer_Tick; 17 | FrameworkDispatcher.Update(); 18 | } 19 | 20 | void frameworkDispatcherTimer_Tick(object sender, EventArgs e) 21 | { 22 | FrameworkDispatcher.Update(); 23 | } 24 | 25 | void IApplicationService.StartService(ApplicationServiceContext context) 26 | { 27 | this.frameworkDispatcherTimer.Start(); 28 | } 29 | 30 | void IApplicationService.StopService() 31 | { 32 | this.frameworkDispatcherTimer.Stop(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/XNAFrameworkDispatcherService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Threading; 4 | using Microsoft.Xna.Framework; 5 | 6 | namespace P3bble 7 | { 8 | public class XNAFrameworkDispatcherService : IApplicationService 9 | { 10 | private DispatcherTimer frameworkDispatcherTimer; 11 | 12 | public XNAFrameworkDispatcherService() 13 | { 14 | this.frameworkDispatcherTimer = new DispatcherTimer(); 15 | this.frameworkDispatcherTimer.Interval = TimeSpan.FromTicks(333333); 16 | this.frameworkDispatcherTimer.Tick += frameworkDispatcherTimer_Tick; 17 | FrameworkDispatcher.Update(); 18 | } 19 | 20 | void frameworkDispatcherTimer_Tick(object sender, EventArgs e) 21 | { 22 | FrameworkDispatcher.Update(); 23 | } 24 | 25 | void IApplicationService.StartService(ApplicationServiceContext context) 26 | { 27 | this.frameworkDispatcherTimer.Start(); 28 | } 29 | 30 | void IApplicationService.StopService() 31 | { 32 | this.frameworkDispatcherTimer.Stop(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Samples/P3bbleWinRT/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // Allgemeine Informationen über eine Assembly werden über die folgenden 6 | // Attribute gesteuert. Diese Attributwerte ändern, um die Informationen zu ändern, 7 | // die einer Assembly zugeordnet sind. 8 | [assembly: AssemblyTitle("P3bbleWP8")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("P3bbleWP8")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: 18 | // 19 | // Hauptversion 20 | // Nebenversion 21 | // Buildnummer 22 | // Revision 23 | // 24 | // Es können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern 25 | // mithilfe von '*' wie unten dargestellt übernommen werden: 26 | // [Assembly: AssemblyVersion("1.0.*")] 27 | [assembly: AssemblyVersion("1.0.0.0")] 28 | [assembly: AssemblyFileVersion("1.0.0.0")] 29 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /src/P3bble.PCL/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Resources; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("P3bble.PCL")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("P3bble.PCL")] 14 | [assembly: AssemblyCopyright("Copyright © 2014")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: NeutralResourcesLanguage("en")] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Build and Revision Numbers 27 | // by using the '*' as shown below: 28 | // [assembly: AssemblyVersion("1.0.*")] 29 | [assembly: AssemblyVersion("1.0.1.1")] 30 | [assembly: AssemblyFileVersion("1.0.1.1")] 31 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | packages 9 | 10 | # Build results 11 | 12 | [Dd]ebug/ 13 | [Rr]elease/ 14 | x64/ 15 | build/ 16 | [Bb]in/ 17 | [Oo]bj/ 18 | 19 | # MSTest test Results 20 | [Tt]est[Rr]esult*/ 21 | [Bb]uild[Ll]og.* 22 | 23 | # ReSharper is a .NET coding add-in 24 | _ReSharper*/ 25 | *.[Rr]e[Ss]harper 26 | 27 | # NuGet Packages Directory 28 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 29 | packages/ 30 | 31 | # Windows Store app package directory 32 | AppPackages/ 33 | 34 | # Others 35 | [Ss]tyle[Cc]op.* 36 | 37 | # Backup & report files from converting an old project file to a newer 38 | # Visual Studio version. Backup files are not needed, because we have git ;-) 39 | _UpgradeReport_Files/ 40 | Backup*/ 41 | UpgradeLog*.XML 42 | UpgradeLog*.htm 43 | 44 | ############# 45 | ## Windows detritus 46 | ############# 47 | 48 | # Windows image file caches 49 | Thumbs.db 50 | ehthumbs.db 51 | 52 | # Folder config file 53 | Desktop.ini 54 | 55 | # Recycle Bin used on file shares 56 | $RECYCLE.BIN/ 57 | 58 | # Mac crap 59 | .DS_Store 60 | 61 | /NuGet/*.nupkg 62 | -------------------------------------------------------------------------------- /NuGet/P3bble.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | P3bble 5 | {VERSION_MADE_BY_SCRIPT} 6 | P3bble 7 | Steve Robbins, Patrik Pfaffenbauer 8 | Steve Robbins, Patrik Pfaffenbauer 9 | https://raw.githubusercontent.com/p3root/P3bble/master/LICENSE.txt 10 | https://github.com/p3root/P3bble 11 | false 12 | P3bble is a framework for connecting to Pebble SmartWatches from Windows Phone 8 and Windows Phone 8.1. 13 | P3bble is a framework for connecting to Pebble SmartWatches from Windows Phone 8 and Windows Phone 8.1. 14 | en-US 15 | Copyright (c) 2013-2014 Patrik Pfaffenbauer, 2014 Steve Robbins 16 | Pebble WindowsPhone wp8 wp8.1 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/P3bble.Core/AsyncLock.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading; 3 | using System.Threading.Tasks; 4 | 5 | namespace P3bble 6 | { 7 | internal sealed class AsyncLock 8 | { 9 | private readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1); 10 | private readonly Task _releaser; 11 | 12 | public AsyncLock() 13 | { 14 | this._releaser = Task.FromResult((IDisposable)new Releaser(this)); 15 | } 16 | 17 | public Task LockAsync() 18 | { 19 | var wait = this._semaphore.WaitAsync(); 20 | return wait.IsCompleted ? 21 | this._releaser : 22 | wait.ContinueWith((_, state) => (IDisposable)state, this._releaser.Result, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default); 23 | } 24 | 25 | private sealed class Releaser : IDisposable 26 | { 27 | private readonly AsyncLock _toRelease; 28 | 29 | internal Releaser(AsyncLock toRelease) 30 | { 31 | this._toRelease = toRelease; 32 | } 33 | 34 | public void Dispose() 35 | { 36 | this._toRelease._semaphore.Release(); 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/P3bble.Core/Types/InstalledApplications.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace P3bble.Types 8 | { 9 | /// 10 | /// Represents the installed applications 11 | /// 12 | public class InstalledApplications 13 | { 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | /// The banks. 18 | internal InstalledApplications(uint banks) 19 | { 20 | this.ApplicationBanks = banks; 21 | this.ApplicationsInstalled = new List(); 22 | } 23 | 24 | /// 25 | /// Gets the number of application banks available. 26 | /// 27 | /// 28 | /// The application banks. 29 | /// 30 | public uint ApplicationBanks { get; private set; } 31 | 32 | /// 33 | /// Gets the applications installed. 34 | /// 35 | /// 36 | /// The applications installed. 37 | /// 38 | public List ApplicationsInstalled { get; private set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/P3bble.Core/Types/BundleManifest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | using P3bble.Helper; 4 | 5 | namespace P3bble.Types 6 | { 7 | [DataContract] 8 | internal class BundleManifest 9 | { 10 | [DataMember(Name = "manifestVersion", IsRequired = true)] 11 | public int ManifestVersion { get; private set; } 12 | 13 | public DateTime GeneratedAt 14 | { 15 | get 16 | { 17 | return this.GeneratedAtInternal.AsDateTime(); 18 | } 19 | } 20 | 21 | [DataMember(Name = "generatedBy", IsRequired = true)] 22 | public string GeneratedBy { get; private set; } 23 | 24 | [DataMember(Name = "application", IsRequired = false)] 25 | public ApplicationManifest ApplicationManifest { get; private set; } 26 | 27 | [DataMember(Name = "firmware", IsRequired = false)] 28 | public FirmwareManifest Firmware { get; private set; } 29 | 30 | [DataMember(Name = "resources", IsRequired = false)] 31 | public ResourcesManifest Resources { get; private set; } 32 | 33 | [DataMember(Name = "type", IsRequired = true)] 34 | public string Type { get; private set; } 35 | 36 | [DataMember(Name = "generatedAt", IsRequired = true)] 37 | internal int GeneratedAtInternal { get; set; } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /NuGet/Package.ps1: -------------------------------------------------------------------------------- 1 | # TODO: Quieten mkdir 2 | $null = mkdir -Force package\lib\windowsphone8 3 | $null = mkdir -Force package\lib\windowsphone8.1 4 | $null = mkdir -Force package\lib\wpa8.1 5 | #$null = mkdir -Force package\lib\portable-net4+sl4+wp7+win8 6 | 7 | copy P3bble.nuspec package 8 | 9 | copy ..\src\P3bble.Core-8.1\bin\Release\P3bble.Core.dll package\lib\wpa8.1 10 | copy ..\src\P3bble.Core-8.1\bin\Release\P3bble.Core.pri package\lib\wpa8.1 11 | 12 | copy ..\src\P3bble.Core\Bin\Release\P3bble.Core.dll package\lib\windowsphone8 13 | copy ..\src\P3bble.Core\Bin\Release\P3bble.Core.XML package\lib\windowsphone8 14 | 15 | copy ..\src\P3bble.Core-S8.1\Bin\Release\P3bble.Core.dll package\lib\windowsphone8.1 16 | copy ..\src\P3bble.Core-S8.1\Bin\Release\P3bble.Core.XML package\lib\windowsphone8.1 17 | 18 | #copy ..\src\P3bble.PCL\Bin\Release\P3bble.PCL.dll package\lib\portable-net4+sl4+wp7+win8 19 | 20 | # Update version number to that of assembly... 21 | $ver = ls -fi .\package\lib\windowsphone8\P3bble.Core.dll | % { $_.versioninfo } 22 | $unversioned = Get-Content package\P3bble.nuspec 23 | $versioned = $unversioned -replace "{VERSION_MADE_BY_SCRIPT}", $ver.FileVersion 24 | Set-Content package\P3bble.nuspec $versioned 25 | 26 | # Finally, package up... 27 | Start-Process -FilePath ..\..\src\.nuget\nuget.exe -ArgumentList "pack P3bble.nuspec" -Wait -WindowStyle Hidden -WorkingDirectory package 28 | 29 | copy package\*.nupkg . 30 | #del package\*.nupkg 31 | 32 | # clear up working folder... 33 | #Remove-Item -Path package -Force -Recurse -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | License 2 | 3 | Copyright (c) 2014, Steve Robbins. 4 | Copyright (c) 2013-2014, p3root - Patrik Pfaffenbauer (patrik.pfaffenbauer@p3.co.at) All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 7 | 8 | Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 9 | 10 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 11 | 12 | Neither the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 15 | -------------------------------------------------------------------------------- /src/Samples/P3bble/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using System.Resources; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("P3bble")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("P3bble")] 14 | [assembly: AssemblyCopyright("Copyright © 2013")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("3f07827e-3781-4849-89cc-4de2902dad55")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Revision and Build Numbers 34 | // by using the '*' as shown below: 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | [assembly: NeutralResourcesLanguageAttribute("en-US")] 38 | -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using System.Resources; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("P3bble")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("P3bble")] 14 | [assembly: AssemblyCopyright("Copyright © 2013")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("3f07827e-3781-4849-89cc-4de2902dad55")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Revision and Build Numbers 34 | // by using the '*' as shown below: 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | [assembly: NeutralResourcesLanguageAttribute("en-US")] 38 | -------------------------------------------------------------------------------- /src/P3bble.Core-8.1/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("P3bble")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("P3bble")] 14 | [assembly: AssemblyCopyright("Copyright © 2013-2014 Patrik Pfaffenbauer and Steve Robbins")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("f5894170-64de-4859-aff8-b4f01cbcafb3")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Revision and Build Numbers 34 | // by using the '*' as shown below: 35 | [assembly: AssemblyVersion("2.2.1.1")] 36 | [assembly: AssemblyFileVersion("2.2.1.1")] 37 | [assembly: NeutralResourcesLanguageAttribute("en-US")] 38 | -------------------------------------------------------------------------------- /src/P3bble.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("P3bble")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("P3bble")] 14 | [assembly: AssemblyCopyright("Copyright © 2013-2014 Patrik Pfaffenbauer and Steve Robbins")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("f5894170-64de-4859-aff8-b4f01cbcafb3")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Revision and Build Numbers 34 | // by using the '*' as shown below: 35 | [assembly: AssemblyVersion("2.2.1.1")] 36 | [assembly: AssemblyFileVersion("2.2.1.1")] 37 | [assembly: NeutralResourcesLanguageAttribute("en-US")] 38 | -------------------------------------------------------------------------------- /src/P3bble.Core-S8.1/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("P3bble")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("P3bble")] 14 | [assembly: AssemblyCopyright("Copyright © 2013-2014 Patrik Pfaffenbauer and Steve Robbins")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("f5894170-64de-4859-aff8-b4f01cbcafb3")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Revision and Build Numbers 34 | // by using the '*' as shown below: 35 | [assembly: AssemblyVersion("2.2.1.1")] 36 | [assembly: AssemblyFileVersion("2.2.1.1")] 37 | [assembly: NeutralResourcesLanguageAttribute("en-US")] 38 | -------------------------------------------------------------------------------- /src/P3bbleWinRT.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("P3bble")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("P3bble")] 14 | [assembly: AssemblyCopyright("Copyright © 2013-2014 Patrik Pfaffenbauer and Steve Robbins")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("f5894170-64de-4859-aff8-b4f01cbcafb3")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Revision and Build Numbers 34 | // by using the '*' as shown below: 35 | [assembly: AssemblyVersion("2.2.1.0")] 36 | [assembly: AssemblyFileVersion("2.2.1.0")] 37 | [assembly: NeutralResourcesLanguageAttribute("en-US")] 38 | -------------------------------------------------------------------------------- /src/Samples/P3bbleWinRT/Package.appxmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | P3bble 6 | Patrik 7 | Assets\StoreLogo.png 8 | 9 | 10 | 6.3.0 11 | 6.3.0 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/P3bble.Core/Types/FirmwareRelease.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | using P3bble.Helper; 4 | 5 | namespace P3bble.Types 6 | { 7 | /// 8 | /// Details about a firmware release 9 | /// 10 | [DataContract] 11 | public class FirmwareRelease : VersionInfo 12 | { 13 | /// 14 | /// Gets the URL. 15 | /// 16 | /// 17 | /// The URL. 18 | /// 19 | [DataMember(Name = "url", IsRequired = true)] 20 | public string Url { get; private set; } 21 | 22 | /// 23 | /// Gets the notes. 24 | /// 25 | /// 26 | /// The notes. 27 | /// 28 | [DataMember(Name = "notes", IsRequired = true)] 29 | public string Notes { get; private set; } 30 | 31 | /// 32 | /// Gets the checksum. 33 | /// 34 | /// 35 | /// The checksum. 36 | /// 37 | [DataMember(Name = "sha-256", IsRequired = true)] 38 | public string Checksum { get; private set; } 39 | 40 | /// 41 | /// Returns a that represents this instance. 42 | /// 43 | /// 44 | /// A that represents this instance. 45 | /// 46 | public override string ToString() 47 | { 48 | string format = "Version: {0}\n" 49 | + "Url: {1}\n" 50 | + "Notes: {2}\n"; 51 | return string.Format(format, this.Version, this.Url, this.Notes); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/P3bble.Core/Messages/PhoneVersionMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using P3bble.Constants; 5 | using P3bble.PCL; 6 | 7 | namespace P3bble.Messages 8 | { 9 | internal class PhoneVersionMessage : P3bbleMessage 10 | { 11 | private const uint PhoneSessionCaps = (uint)SessionCaps.GammaRay; 12 | private const uint RemoteCapsMusicControl = (uint)(RemoteCaps.Telephony | RemoteCaps.Sms | RemoteCaps.Android | RemoteCaps.Gps); 13 | private const uint RemoteCapsNormal = (uint)(RemoteCaps.Telephony | RemoteCaps.Sms | RemoteCaps.Windows | RemoteCaps.Gps); 14 | 15 | private uint _remoteCaps; 16 | 17 | public PhoneVersionMessage(bool musicControlEnabled) 18 | : base(Endpoint.PhoneVersion) 19 | { 20 | ServiceLocator.Logger.WriteLine("PhoneVersionMessage musicControlEnabled=" + musicControlEnabled.ToString()); 21 | if (musicControlEnabled) 22 | { 23 | this._remoteCaps = RemoteCapsMusicControl; 24 | } 25 | else 26 | { 27 | this._remoteCaps = RemoteCapsNormal; 28 | } 29 | } 30 | 31 | protected override void GetContentFromMessage(List payload) 32 | { 33 | } 34 | 35 | protected override void AddContentToMessage(List payload) 36 | { 37 | byte[] prefix = { 0x01, 0xFF, 0xFF, 0xFF, 0xFF }; 38 | byte[] session = BitConverter.GetBytes(PhoneSessionCaps); 39 | byte[] remote = BitConverter.GetBytes(this._remoteCaps); 40 | if (BitConverter.IsLittleEndian) 41 | { 42 | Array.Reverse(session); 43 | Array.Reverse(remote); 44 | } 45 | 46 | byte[] msg = new byte[0]; 47 | msg = msg.Concat(prefix).Concat(session).Concat(remote).ToArray(); 48 | 49 | payload.AddRange(msg); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/P3bble.Core/Messages/VersionMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using P3bble.Constants; 6 | using P3bble.Types; 7 | 8 | namespace P3bble.Messages 9 | { 10 | internal class VersionMessage : P3bbleMessage 11 | { 12 | public VersionMessage() 13 | : base(Endpoint.Version) 14 | { 15 | } 16 | 17 | public FirmwareVersion Firmware { get; private set; } 18 | 19 | public FirmwareVersion RecoveryFirmware { get; private set; } 20 | 21 | protected override void AddContentToMessage(List payload) 22 | { 23 | payload.Add(0x00); 24 | } 25 | 26 | protected override void GetContentFromMessage(List payload) 27 | { 28 | byte[] data = payload.ToArray(); 29 | 30 | this.Firmware = ParseVersion(data.Skip(1).Take(47).ToArray()); 31 | this.RecoveryFirmware = ParseVersion(data.Skip(48).Take(47).ToArray()); 32 | } 33 | 34 | private static FirmwareVersion ParseVersion(byte[] data) 35 | { 36 | byte[] _ts = data.Take(4).ToArray(); 37 | if (BitConverter.IsLittleEndian) 38 | { 39 | Array.Reverse(_ts); 40 | } 41 | 42 | int timestamp = BitConverter.ToInt32(_ts, 0); 43 | string version = Encoding.UTF8.GetString(data.Skip(4).Take(32).ToArray(), 0, 32); 44 | string commit = Encoding.UTF8.GetString(data.Skip(36).Take(8).ToArray(), 0, 8); 45 | version = version.Substring(0, version.IndexOf('\0')); 46 | commit = commit.Substring(0, commit.IndexOf('\0')); 47 | bool is_recovery = BitConverter.ToBoolean(data, 44); 48 | byte hardware_platform = data[45]; 49 | byte metadata_ver = data[46]; 50 | return new FirmwareVersion(timestamp, version, commit, is_recovery, hardware_platform, metadata_ver); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/P3bble.Core/Types/ApplicationManifest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | using P3bble.Helper; 4 | 5 | namespace P3bble.Types 6 | { 7 | /// 8 | /// Represents an application manifest 9 | /// 10 | [DataContract] 11 | public struct ApplicationManifest 12 | { 13 | /// 14 | /// Gets the filename. 15 | /// 16 | /// 17 | /// The filename. 18 | /// 19 | [DataMember(Name = "name", IsRequired = true)] 20 | public string Filename { get; private set; } 21 | 22 | /// 23 | /// Gets the required firmware version. 24 | /// 25 | /// 26 | /// The required firmware version. 27 | /// 28 | [DataMember(Name = "reqFwVer", IsRequired = false)] 29 | public int RequiredFirmwareVersion { get; private set; } 30 | 31 | /// 32 | /// Gets the timestamp. 33 | /// 34 | /// 35 | /// The timestamp. 36 | /// 37 | public DateTime Timestamp 38 | { 39 | get 40 | { 41 | return this.TimestampInternal.AsDateTime(); 42 | } 43 | } 44 | 45 | /// 46 | /// Gets the CRC. 47 | /// 48 | /// 49 | /// The CRC. 50 | /// 51 | [DataMember(Name = "crc", IsRequired = true)] 52 | public uint CRC { get; private set; } 53 | 54 | /// 55 | /// Gets the size. 56 | /// 57 | /// 58 | /// The size. 59 | /// 60 | [DataMember(Name = "size", IsRequired = true)] 61 | public int Size { get; private set; } 62 | 63 | [DataMember(Name = "timestamp", IsRequired = true)] 64 | internal int TimestampInternal { get; set; } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Properties/WMAppManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Assets\ApplicationIcon.png 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | Assets\Tiles\FlipCycleTileSmall.png 21 | 0 22 | Assets\Tiles\FlipCycleTileMedium.png 23 | P3bble 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/Samples/P3bble-8.1/Package.appxmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | P3bble 7 | Patrik Pfaffenbauer 8 | Assets\StoreLogo.png 9 | 10 | 11 | 6.3.1 12 | 6.3.1 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /src/P3bble.Core/Messages/NotificationMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using P3bble.Constants; 7 | 8 | namespace P3bble.Messages 9 | { 10 | /// 11 | /// Represents a notification type 12 | /// 13 | internal enum NotificationType 14 | { 15 | /// 16 | /// The email type 17 | /// 18 | Email = 0, 19 | 20 | /// 21 | /// The SMS type 22 | /// 23 | SMS = 1, 24 | 25 | /// 26 | /// The facebook type 27 | /// 28 | Facebook = 2 29 | } 30 | 31 | internal class NotificationMessage : P3bbleMessage 32 | { 33 | private NotificationType _type; 34 | private List _parts; 35 | 36 | public NotificationMessage(NotificationType type, params string[] parts) 37 | : base(Endpoint.Notification) 38 | { 39 | this._type = type; 40 | this._parts = parts.ToList(); 41 | } 42 | 43 | protected override void AddContentToMessage(List payload) 44 | { 45 | string[] ts = { (new DateTime(1970, 1, 1) - DateTime.Now).TotalSeconds.ToString() }; 46 | string[] parts = this._parts.Take(2).Concat(ts).Concat(this._parts.Skip(2)).ToArray(); 47 | byte[] data = { (byte)this._type }; 48 | 49 | foreach (string part in parts) 50 | { 51 | byte[] _part = Encoding.UTF8.GetBytes(part); 52 | if (_part.Length > 255) 53 | { 54 | _part = _part.Take(255).ToArray(); 55 | } 56 | 57 | byte[] len = { Convert.ToByte(_part.Length) }; 58 | data = data.Concat(len).Concat(_part).ToArray(); 59 | } 60 | 61 | payload.AddRange(data); 62 | } 63 | 64 | protected override void GetContentFromMessage(List payload) 65 | { 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/Samples/P3bble/Properties/WMAppManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Assets\ApplicationIcon.png 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | Assets\Tiles\FlipCycleTileSmall.png 21 | 0 22 | Assets\Tiles\FlipCycleTileMedium.png 23 | P3bble 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/P3bble.Core/Constants/RemoteCaps.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace P3bble.Constants 8 | { 9 | /// 10 | /// The phone capabilites 11 | /// 12 | [Flags] 13 | internal enum RemoteCaps : uint 14 | { 15 | /// 16 | /// Unknown capability 17 | /// 18 | Unknown = 0, 19 | 20 | /// 21 | /// IOS platform 22 | /// 23 | IOS = 1, 24 | 25 | /// 26 | /// Android platform 27 | /// 28 | Android = 2, 29 | 30 | /// 31 | /// OSX platform 32 | /// 33 | OSX = 3, 34 | 35 | /// 36 | /// Linux platform 37 | /// 38 | Linux = 4, 39 | 40 | /// 41 | /// Windows platform 42 | /// 43 | Windows = 5, 44 | 45 | /// 46 | /// The telephony capability 47 | /// 48 | Telephony = 16, 49 | 50 | /// 51 | /// The SMS capability 52 | /// 53 | Sms = 32, 54 | 55 | /// 56 | /// The GPS capability 57 | /// 58 | Gps = 64, 59 | 60 | /// 61 | /// The BTLE capability 62 | /// 63 | BTLE = 128, 64 | 65 | /// 66 | /// The front camera capability 67 | /// 68 | CameraFront = 240, 69 | 70 | /// 71 | /// The rear camera capability 72 | /// 73 | CameraRear = 256, 74 | 75 | /// 76 | /// The acceleromter capability 77 | /// 78 | Acceleromter = 512, 79 | 80 | /// 81 | /// The gyroscope capability 82 | /// 83 | Gyroscope = 1024, 84 | 85 | /// 86 | /// The compass capability 87 | /// 88 | Compass = 2048 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/P3bble.Core/Messages/TimeMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using P3bble.Constants; 5 | using P3bble.Helper; 6 | using P3bble.PCL; 7 | 8 | namespace P3bble.Messages 9 | { 10 | /// 11 | /// Represents the time message 12 | /// 13 | internal enum TimeMessageAction : byte 14 | { 15 | /// 16 | /// Get the time 17 | /// 18 | GetTime = 0, 19 | 20 | /// 21 | /// Set the time 22 | /// 23 | SetTime = 2 24 | } 25 | 26 | internal class TimeMessage : P3bbleMessage 27 | { 28 | private TimeMessageAction _action; 29 | 30 | public TimeMessage() 31 | : base(Endpoint.Time) 32 | { 33 | this._action = TimeMessageAction.GetTime; 34 | } 35 | 36 | public TimeMessage(DateTime time) 37 | : base(Endpoint.Time) 38 | { 39 | this._action = TimeMessageAction.SetTime; 40 | this.Time = time; 41 | } 42 | 43 | public DateTime Time { get; private set; } 44 | 45 | protected override void AddContentToMessage(List payload) 46 | { 47 | if (this._action == TimeMessageAction.GetTime) 48 | { 49 | payload.Add((byte)this._action); 50 | } 51 | else 52 | { 53 | ServiceLocator.Logger.WriteLine("Set Time to " + this.Time.ToString()); 54 | 55 | byte[] rawTime = BitConverter.GetBytes(this.Time.AsEpoch()); 56 | if (BitConverter.IsLittleEndian) 57 | { 58 | Array.Reverse(rawTime); 59 | } 60 | 61 | // Magic number required for the time to be set! 62 | payload.Add((byte)this._action); 63 | 64 | payload.AddRange(rawTime); 65 | } 66 | } 67 | 68 | protected override void GetContentFromMessage(List payload) 69 | { 70 | byte[] payloadArray = payload.ToArray(); 71 | if (BitConverter.IsLittleEndian) 72 | { 73 | Array.Reverse(payloadArray, 1, 4); 74 | } 75 | 76 | int timestamp = BitConverter.ToInt32(payloadArray, 1); 77 | this.Time = timestamp.AsDateTime(); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/Samples/P3bble/Package.appxmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | P3bble 12 | Patrik 13 | Assets\StoreLogo.png 14 | 15 | 16 | 17 | 6.3.1 18 | 6.3.1 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | AgHostSvcs.dll 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/Samples/P3bble-S8.1/Package.appxmanifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 10 | 11 | P3bble 12 | Patrik 13 | Assets\StoreLogo.png 14 | 15 | 16 | 17 | 6.3.1 18 | 6.3.1 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | AgHostSvcs.dll 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/P3bble.Core/Types/FirmwareManifest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | using P3bble.Helper; 4 | 5 | namespace P3bble.Types 6 | { 7 | /// 8 | /// Represents details of a firmware bundle 9 | /// 10 | [DataContract] 11 | public struct FirmwareManifest 12 | { 13 | /// 14 | /// Gets the filename. 15 | /// 16 | /// 17 | /// The filename. 18 | /// 19 | [DataMember(Name = "name", IsRequired = true)] 20 | public string Filename { get; private set; } 21 | 22 | /// 23 | /// Gets the timestamp. 24 | /// 25 | /// 26 | /// The timestamp. 27 | /// 28 | public DateTime Timestamp 29 | { 30 | get 31 | { 32 | return this.TimestampInternal.AsDateTime(); 33 | } 34 | } 35 | 36 | /// 37 | /// Gets the CRC. 38 | /// 39 | /// 40 | /// The CRC. 41 | /// 42 | [DataMember(Name = "crc", IsRequired = true)] 43 | public uint CRC { get; private set; } 44 | 45 | /// 46 | /// Gets the hardware revision. 47 | /// 48 | /// 49 | /// The hardware revision. 50 | /// 51 | [DataMember(Name = "hwrev", IsRequired = true)] 52 | public string HardwareRevision { get; private set; } 53 | 54 | /// 55 | /// Gets the type. 56 | /// 57 | /// 58 | /// The type. 59 | /// 60 | [DataMember(Name = "type", IsRequired = true)] 61 | public string Type { get; private set; } 62 | 63 | /// 64 | /// Gets a value indicating whether the firmware is recovery. 65 | /// 66 | /// 67 | /// true if recovery. 68 | /// 69 | public bool IsRecovery 70 | { 71 | get 72 | { 73 | return this.Type == "recovery"; 74 | } 75 | } 76 | 77 | /// 78 | /// Gets the size. 79 | /// 80 | /// 81 | /// The size. 82 | /// 83 | [DataMember(Name = "size", IsRequired = true)] 84 | public int Size { get; private set; } 85 | 86 | [DataMember(Name = "timestamp", IsRequired = true)] 87 | internal int TimestampInternal { get; set; } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /src/P3bble.Core/Messages/MusicMessage.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Text; 4 | using P3bble.Constants; 5 | using P3bble.Types; 6 | 7 | namespace P3bble.Messages 8 | { 9 | internal class MusicMessage : P3bbleMessage 10 | { 11 | private string _artist; 12 | private string _album; 13 | private string _track; 14 | 15 | public MusicMessage() 16 | : base(Endpoint.MusicControl) 17 | { 18 | } 19 | 20 | public MusicMessage(string artist, string album, string track) 21 | : base(Endpoint.MusicControl) 22 | { 23 | this._artist = artist; 24 | this._album = album; 25 | this._track = track; 26 | 27 | // Check lengths... 28 | this.TrimValue(ref this._artist); 29 | this.TrimValue(ref this._album); 30 | this.TrimValue(ref this._track); 31 | } 32 | 33 | /// 34 | /// Gets or sets the control action. 35 | /// 36 | /// 37 | /// The control action. 38 | /// 39 | public MusicControlAction ControlAction { get; set; } 40 | 41 | protected override void AddContentToMessage(List payload) 42 | { 43 | // No idea what this does. Do it anyway. 44 | byte[] data = { 16 }; 45 | 46 | byte[] artist = Encoding.UTF8.GetBytes(this._artist); 47 | byte[] album = Encoding.UTF8.GetBytes(this._album); 48 | byte[] track = Encoding.UTF8.GetBytes(this._track); 49 | byte[] artistlen = { (byte)artist.Length }; 50 | byte[] albumlen = { (byte)album.Length }; 51 | byte[] tracklen = { (byte)track.Length }; 52 | 53 | data = data.Concat(artistlen).Concat(artist).ToArray(); 54 | data = data.Concat(albumlen).Concat(album).ToArray(); 55 | data = data.Concat(tracklen).Concat(track).ToArray(); 56 | 57 | payload.AddRange(data); 58 | } 59 | 60 | protected override void GetContentFromMessage(List payload) 61 | { 62 | this.ControlAction = (MusicControlAction)payload[0]; 63 | } 64 | 65 | /// 66 | /// Trims a value to the max length we can send. 67 | /// 68 | /// The value. 69 | private void TrimValue(ref string value) 70 | { 71 | if (value != null && value.Length > 30) 72 | { 73 | value = value.Substring(0, 27) + "..."; 74 | } 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/Settings.StyleCop: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | api.developer.nokia.com 5 | appCode 6 | AppCode 7 | appId 8 | AppID 9 | json 10 | params 11 | querystring 12 | 13 | 14 | 15 | 16 | 17 | 18 | \.g\.cs$ 19 | \.generated\.cs$ 20 | \.g\.i\.cs$ 21 | TemporaryGeneratedFile_.*\.cs$ 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | False 32 | 33 | 34 | 35 | 36 | False 37 | 38 | 39 | 40 | 41 | False 42 | 43 | 44 | 45 | 46 | False 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | False 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | False 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /src/P3bble.PCL/P3bble.PCL.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11.0 6 | Debug 7 | AnyCPU 8 | {76E03460-2CD0-4580-ADA0-A5FE68CB7E1C} 9 | Library 10 | Properties 11 | P3bble.PCL 12 | P3bble.PCL 13 | v4.5 14 | Profile259 15 | 512 16 | {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 51 | -------------------------------------------------------------------------------- /src/P3bble.Core/Logger.cs: -------------------------------------------------------------------------------- 1 | using P3bble.PCL; 2 | using P3bble.PCL.Logger; 3 | using System; 4 | using System.Diagnostics; 5 | using System.IO; 6 | #if WINDOWS_PHONE_APP 7 | #else 8 | using System.IO.IsolatedStorage; 9 | #endif 10 | using System.Threading; 11 | using Windows.Storage; 12 | 13 | namespace P3bble 14 | { 15 | /// 16 | /// Logging to track down problems in production apps 17 | /// 18 | internal class Logger : BaseLogger 19 | { 20 | private string FileName { get; set; } 21 | 22 | /// 23 | /// Writes a line to the debug log. 24 | /// 25 | /// The message. 26 | public override void WriteLine(string message) 27 | { 28 | Debug.WriteLine(message); 29 | 30 | if (string.IsNullOrEmpty(FileName)) 31 | { 32 | FileName = string.Format("Log-{0:yyyy-MM-dd-HH-mm-ss}.txt", DateTime.Now); 33 | Debug.WriteLine("Logger initialised; writing to " + FileName); 34 | } 35 | 36 | lock (FileName) 37 | { 38 | if (IsEnabled) 39 | { 40 | using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication()) 41 | { 42 | using (StreamWriter sw = new StreamWriter(store.OpenFile(FileName, FileMode.Append, FileAccess.Write))) 43 | { 44 | sw.Write(message + "\n"); 45 | } 46 | } 47 | } 48 | else 49 | { 50 | // This is a HORRIBLE hack! 51 | // There is something strange happening in message sequencing that goes 52 | // away when logging to a file - so when RELEASE mode with logging OFF, 53 | // this is my only alternative for now. I am a bad person. 54 | Thread.Sleep(10); 55 | } 56 | } 57 | } 58 | 59 | /// 60 | /// Clears up the current log file. 61 | /// 62 | public override void ClearUp() 63 | { 64 | if (!string.IsNullOrEmpty(FileName)) 65 | { 66 | lock (FileName) 67 | { 68 | using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication()) 69 | { 70 | store.DeleteFile(FileName); 71 | } 72 | } 73 | 74 | FileName = null; 75 | } 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /src/P3bble.Core/Messages/SystemMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using P3bble.Constants; 6 | 7 | namespace P3bble.Messages 8 | { 9 | /// 10 | /// System command 11 | /// 12 | internal enum SystemCommand : byte 13 | { 14 | /// 15 | /// The firmware available command 16 | /// 17 | FirmwareAvailable = 0, 18 | 19 | /// 20 | /// The firmware start command 21 | /// 22 | FirmwareStart = 1, 23 | 24 | /// 25 | /// The firmware complete command 26 | /// 27 | FirmwareComplete = 2, 28 | 29 | /// 30 | /// The firmware fail command 31 | /// 32 | FirmwareFail = 3, 33 | 34 | /// 35 | /// The firmware up to date command 36 | /// 37 | FirmwareUpToDate = 4, 38 | 39 | /// 40 | /// The firmware out of date command 41 | /// 42 | FirmwareOutOfDate = 5, 43 | 44 | /// 45 | /// The bluetooth start discoverable command 46 | /// 47 | BluetoothStartDiscoverable = 6, 48 | 49 | /// 50 | /// The bluetooth end discoverable command 51 | /// 52 | BluetoothEndDiscoverable = 7 53 | } 54 | 55 | /// 56 | /// The System Message 57 | /// 58 | /// These messages are used to signal important events/state-changes to the watch firmware. 59 | /// 60 | /// 61 | internal class SystemMessage : P3bbleMessage 62 | { 63 | public SystemMessage() 64 | : base(Endpoint.SystemMessage) 65 | { 66 | } 67 | 68 | public SystemMessage(SystemCommand command) 69 | : this() 70 | { 71 | this.Command = command; 72 | } 73 | 74 | /// 75 | /// Gets the system command. 76 | /// 77 | /// 78 | /// The system command. 79 | /// 80 | public SystemCommand Command { get; private set; } 81 | 82 | protected override void AddContentToMessage(List payload) 83 | { 84 | payload.Add(0); 85 | 86 | // Add the command 87 | payload.Add((byte)this.Command); 88 | } 89 | 90 | protected override void GetContentFromMessage(List payload) 91 | { 92 | this.Command = (SystemCommand)payload[1]; 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /src/P3bble.Core/Messages/PhoneControlMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using P3bble.Constants; 6 | 7 | namespace P3bble.Messages 8 | { 9 | /// 10 | /// Represents the phone control type 11 | /// 12 | internal enum PhoneControlType : byte 13 | { 14 | /// 15 | /// Answer the phone 16 | /// 17 | Answer = 1, 18 | 19 | /// 20 | /// Hang up the phone 21 | /// 22 | HangUp = 2, 23 | 24 | /// 25 | /// Get state 26 | /// 27 | GetState = 3, 28 | 29 | /// 30 | /// Incoming call 31 | /// 32 | IncomingCall = 4, 33 | 34 | /// 35 | /// Outgoing call 36 | /// 37 | OutgoingCall = 5, 38 | 39 | /// 40 | /// Missed call 41 | /// 42 | MissedCall = 6, 43 | 44 | /// 45 | /// Ring the phone 46 | /// 47 | Ring = 7, 48 | 49 | /// 50 | /// Start the phone 51 | /// 52 | Start = 8, 53 | 54 | /// 55 | /// End the phone 56 | /// 57 | End = 9 58 | } 59 | 60 | internal class PhoneControlMessage : P3bbleMessage 61 | { 62 | private PhoneControlType _type; 63 | private List _parts; 64 | private byte[] _cookie; 65 | 66 | public PhoneControlMessage(PhoneControlType type, byte[] cookie, params string[] parts) 67 | : base(Endpoint.PhoneControl) 68 | { 69 | this._type = type; 70 | this._parts = parts.ToList(); 71 | this._cookie = cookie; 72 | } 73 | 74 | protected override void AddContentToMessage(List payload) 75 | { 76 | string[] parts = this._parts.ToArray(); 77 | byte[] data = { (byte)this._type, }; 78 | 79 | data = data.Concat(this._cookie).ToArray(); 80 | 81 | foreach (string part in parts) 82 | { 83 | byte[] bytePart = Encoding.UTF8.GetBytes(part); 84 | if (bytePart.Length > 255) 85 | { 86 | bytePart = bytePart.Take(255).ToArray(); 87 | } 88 | 89 | byte[] len = { Convert.ToByte(bytePart.Length) }; 90 | data = data.Concat(len).Concat(bytePart).ToArray(); 91 | } 92 | 93 | payload.AddRange(data); 94 | } 95 | 96 | protected override void GetContentFromMessage(List payload) 97 | { 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | P3bble 2 | ====== 3 | 4 | P3bble is a framework for connecting to Pebble SmartWatches from Windows Phone 8. 5 | 6 | ## Donate 7 | [![Donate with Bitcoin](https://en.cryptobadges.io/badge/micro/1Ck4XgAxys3aBjdesKQQ62zx7m4vozUest)](https://en.cryptobadges.io/donate/1Ck4XgAxys3aBjdesKQQ62zx7m4vozUest) 8 | 9 | Donate DogeCoin: DPVz6RSAJrXZqTF4sGXpS1dqwvU36hSaAQ 10 | 11 | 12 | 13 | Getting Started: 14 | ================ 15 | 16 | * Install [P3bble](https://www.nuget.org/packages/P3bble) from Nuget or clone this repo and build from source. 17 | * Add `ID_CAP_PROXIMITY` to WMAppManifest.xml to allow connections from your app. 18 | * Detect and connect to the first Pebble found: 19 | 20 | To use the library with Windows Phone 8.1 and WinRT (WinRT not finished currently), you need to add this 21 | 22 | ``` 23 | 24 | 25 | 26 | 27 | 28 | ``` 29 | in your Package.appxmanifest beetween the "Capabilities" Tag. 30 | 31 | ``` 32 | var pebbles = await P3bble.Pebble.DetectPebbles(); 33 | if (pebbles != null && pebbles.Count > 0) 34 | { 35 | bool connected = await pebbles[0].ConnectAsync(); 36 | if (connected) 37 | { 38 | MessageBox.Show("connected to " + pebbles[0].DisplayName); 39 | } 40 | else 41 | { 42 | MessageBox.Show("could not connect"); 43 | } 44 | } 45 | ``` 46 | Version 2.2 features: 47 | ===================== 48 | * Added support for Windows Phone Silverlight 8.1 49 | * Added support for Windows Phone 8.1 50 | 51 | 52 | 53 | Version 2.0 features: 54 | ===================== 55 | 56 | * Get and Set Time 57 | * List installed apps 58 | * Remove app by index 59 | * Install app from PBW 60 | * Launch app 61 | * Install firmware 62 | * Music control works from foreground app 63 | * Refactored methods to be async/await instead of using events 64 | * Patched FindPebbles to only include items starting "Pebble" 65 | * Added interface for P3bble to allow mocking 66 | * Changed from WebClient to [HttpClient](https://www.nuget.org/packages/Microsoft.Net.Http) to make code more portable 67 | * Changed from SharpGISto [sharpcompress](https://www.nuget.org/packages/sharpcompress/) to make code more portable 68 | 69 | Version 2.0 features were added by [Steve Robbins](https://twitter.com/sr_gb) - but they were only possible because of the work that Patrik did originally as well as the [Python reverse engineering work](https://github.com/Hexxeh/libpebble). 70 | 71 | *TODO: WinRT not working yet - unable to connect to Bluetooth paired devices - any help getting this working appreciated!* 72 | 73 | Version 1.0 74 | =========== 75 | Version 1.0 created by [Patrik Pfaffenbauer](https://twitter.com/p3root) - see 76 | 77 | 78 | License 79 | ======= 80 | 81 | P3bble is released under the 3-clause license ("New BSD License" or "Modified BSD License") - see https://raw.githubusercontent.com/p3root/P3bble/master/LICENSE.txt 82 | 83 | -------------------------------------------------------------------------------- /src/P3bble.Core/Constants/Endpoint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace P3bble.Constants 8 | { 9 | /// 10 | /// The endpoint 11 | /// 12 | internal enum Endpoint 13 | { 14 | /// 15 | /// Firmware endpoint 16 | /// 17 | Firmware = 1, 18 | 19 | /// 20 | /// Time endpoint 21 | /// 22 | Time = 11, 23 | 24 | /// 25 | /// Version endpoint 26 | /// 27 | Version = 16, 28 | 29 | /// 30 | /// Pebble is requesting details about the phone version 31 | /// 32 | PhoneVersion = 17, 33 | 34 | /// 35 | /// The system message endpoint 36 | /// 37 | SystemMessage = 18, 38 | 39 | /// 40 | /// The music control endpoint 41 | /// 42 | MusicControl = 32, 43 | 44 | /// 45 | /// The phone control endpoint 46 | /// 47 | PhoneControl = 33, 48 | 49 | /// 50 | /// The application message endpoint 51 | /// 52 | ApplicationMessage = 48, 53 | 54 | /// 55 | /// The launcher endpoint 56 | /// 57 | Launcher = 49, 58 | 59 | /// 60 | /// The logs endpoint 61 | /// 62 | Logs = 2000, 63 | 64 | /// 65 | /// The ping endpoint 66 | /// 67 | Ping = 2001, 68 | 69 | /// 70 | /// The logs dump endpoint 71 | /// 72 | LogsDump = 2002, 73 | 74 | /// 75 | /// The reset endpoint 76 | /// 77 | Reset = 2003, 78 | 79 | ////AppMfg = 2004, - seems unused 80 | 81 | /// 82 | /// The application logs endpoint 83 | /// 84 | AppLogs = 2006, 85 | 86 | /// 87 | /// The notification endpoint 88 | /// 89 | Notification = 3000, 90 | 91 | /// 92 | /// The resource endpoint 93 | /// 94 | Resource = 4000, 95 | 96 | /// 97 | /// The system reg endpoint 98 | /// 99 | SysReg = 5000, 100 | 101 | /// 102 | /// The FCT reg endpoint 103 | /// 104 | FctReg = 5001, 105 | 106 | /// 107 | /// The application manager endpoint 108 | /// 109 | AppManager = 6000, 110 | 111 | /// 112 | /// The run keeper endpoint 113 | /// 114 | RunKeeper = 7000, 115 | 116 | /// 117 | /// The put bytes endpoint 118 | /// 119 | PutBytes = 48879 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /src/Samples/P3bbleWinRT/MainPage.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |