├── src ├── AllJoynClientLib.sln.GhostDoc.user.dic ├── AllJoynSampleApp │ ├── Assets │ │ ├── HueIcon.png │ │ ├── Brightness.png │ │ ├── Saturation.png │ │ ├── StoreLogo.png │ │ ├── Surface-Dial.png │ │ ├── SplashScreen.scale-200.png │ │ ├── LockScreenLogo.scale-200.png │ │ ├── Square44x44Logo.scale-200.png │ │ ├── Wide310x150Logo.scale-200.png │ │ ├── Square150x150Logo.scale-200.png │ │ └── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── AllJoynSampleApp_StoreKey.pfx │ ├── AllJoynSampleApp_TemporaryKey.pfx │ ├── App.xaml │ ├── project.json │ ├── Converters │ │ ├── BoolToCollapsedConverter.cs │ │ ├── TimeSpanConverter.cs │ │ ├── BoolToVisibilityConverter.cs │ │ └── NullToCollapsedConverter.cs │ ├── AboutPage.xaml │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── Default.rd.xml │ ├── Controls │ │ ├── TemplatePickerContentControl.cs │ │ ├── ColorPicker.xaml │ │ ├── BrightnessPicker.cs │ │ ├── ColorRangePicker.cs │ │ ├── ColorPicker.xaml.cs │ │ └── ColorTemperaturePicker.cs │ ├── ViewModels │ │ ├── SwitchVM.cs │ │ ├── PhilipsHueBridgeVM.cs │ │ ├── CurrentHumidityVM.cs │ │ ├── GenericCommand.cs │ │ ├── CurrentTemperatureVM.cs │ │ ├── ViewModelBase.cs │ │ ├── DeviceVMBase .cs │ │ ├── MainViewModel.cs │ │ └── LightVM.cs │ ├── AboutPage.xaml.cs │ ├── DeviceViews │ │ ├── SwitchClientView.xaml │ │ ├── SwitchClientView.xaml.cs │ │ ├── PhilipsHueBridgeView.xaml.cs │ │ ├── HumidityClientView.xaml │ │ ├── TemperatureClientVIew.xaml │ │ ├── HumidityClientView.xaml.cs │ │ ├── TemperatureClientVIew.xaml.cs │ │ ├── PhilipsHueBridgeView.xaml │ │ ├── AllPlayClientView.xaml.cs │ │ ├── LightClientView.xaml │ │ └── LightClientView.xaml.cs │ ├── DevicePlugins │ │ └── PhilipsHueDSB.cs │ ├── Package.appxmanifest │ ├── ThrottleTask.cs │ ├── TemplateTypeSelector.cs │ ├── AboutText.rtf │ ├── MainPage.xaml.cs │ └── App.xaml.cs ├── Nuget │ ├── build.cmd │ └── dotMorten.AllJoyn.AllJoynClientLib.nuspec ├── AllJoynDeviceLib │ ├── Devices │ │ ├── UnknownClient.cs │ │ ├── AllPlay │ │ │ ├── ShuffleMode.cs │ │ │ ├── LoopMode.cs │ │ │ ├── ZoneChangedEventArgs.cs │ │ │ ├── PlayerReadyEventArgs.cs │ │ │ ├── MediaState.cs │ │ │ ├── SlaveStateEventArgs.cs │ │ │ ├── PlaybackErrorEventArgs.cs │ │ │ ├── Playlist.cs │ │ │ ├── PlayerInfo.cs │ │ │ ├── ZoneInfo.cs │ │ │ ├── EnabledControls.cs │ │ │ ├── PlayerClient.cs │ │ │ ├── PlayState.cs │ │ │ ├── ZoneManager.cs │ │ │ ├── Mcu.cs │ │ │ ├── MediaPlayer.Signals.cs │ │ │ ├── Media.cs │ │ │ ├── Volume.cs │ │ │ └── Introspection.xml │ │ ├── Switch │ │ │ ├── ZigBeeDsbSwitch.cs │ │ │ ├── SwitchClient.cs │ │ │ └── HaeSwitch.cs │ │ ├── SmartSpaces │ │ │ ├── CurrentHumidityClient.cs │ │ │ └── CurrentTemperatureClient.cs │ │ ├── LSF │ │ │ └── LightClient.Details.cs │ │ ├── Extensions.cs │ │ └── DeviceClient.cs │ ├── project.json │ ├── stylecop.json │ ├── GlobalSuppressions.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── AllJoynDeviceLib.rd.xml │ ├── AllJoynServiceException.cs │ ├── AllJoynClientLib.csproj │ └── DeviceManager.cs └── AllJoynClientLib.sln ├── README.md └── .gitignore /src/AllJoynClientLib.sln.GhostDoc.user.dic: -------------------------------------------------------------------------------- 1 | alljoyn 2 | playlists 3 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Assets/HueIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotMorten/AllJoynClientLib/HEAD/src/AllJoynSampleApp/Assets/HueIcon.png -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Assets/Brightness.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotMorten/AllJoynClientLib/HEAD/src/AllJoynSampleApp/Assets/Brightness.png -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Assets/Saturation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotMorten/AllJoynClientLib/HEAD/src/AllJoynSampleApp/Assets/Saturation.png -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotMorten/AllJoynClientLib/HEAD/src/AllJoynSampleApp/Assets/StoreLogo.png -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Assets/Surface-Dial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotMorten/AllJoynClientLib/HEAD/src/AllJoynSampleApp/Assets/Surface-Dial.png -------------------------------------------------------------------------------- /src/AllJoynSampleApp/AllJoynSampleApp_StoreKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotMorten/AllJoynClientLib/HEAD/src/AllJoynSampleApp/AllJoynSampleApp_StoreKey.pfx -------------------------------------------------------------------------------- /src/AllJoynSampleApp/AllJoynSampleApp_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotMorten/AllJoynClientLib/HEAD/src/AllJoynSampleApp/AllJoynSampleApp_TemporaryKey.pfx -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotMorten/AllJoynClientLib/HEAD/src/AllJoynSampleApp/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotMorten/AllJoynClientLib/HEAD/src/AllJoynSampleApp/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotMorten/AllJoynClientLib/HEAD/src/AllJoynSampleApp/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotMorten/AllJoynClientLib/HEAD/src/AllJoynSampleApp/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotMorten/AllJoynClientLib/HEAD/src/AllJoynSampleApp/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dotMorten/AllJoynClientLib/HEAD/src/AllJoynSampleApp/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /src/Nuget/build.cmd: -------------------------------------------------------------------------------- 1 | XCOPY ..\AllJoynDeviceLib\bin\Release\AllJoynClientLib.dll package\lib\uap10.0\ /Y 2 | XCOPY dotMorten.AllJoyn.AllJoynClientLib.nuspec package\ /Y 3 | nuget pack package\dotMorten.AllJoyn.AllJoynClientLib.nuspec 4 | RMDIR package /S /Q -------------------------------------------------------------------------------- /src/AllJoynSampleApp/App.xaml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/AllJoynDeviceLib/Devices/UnknownClient.cs: -------------------------------------------------------------------------------- 1 | namespace AllJoynClientLib.Devices 2 | { 3 | /// 4 | /// Unknown Device. 5 | /// 6 | /// 7 | public class UnknownClient : DeviceClient 8 | { 9 | internal UnknownClient(DeviceProviders.IService service) : base(service) 10 | { 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/AllJoynDeviceLib/Devices/AllPlay/ShuffleMode.cs: -------------------------------------------------------------------------------- 1 | namespace AllJoynClientLib.Devices.AllPlay 2 | { 3 | /// 4 | /// Playlist shuffle mode 5 | /// 6 | public enum ShuffleMode 7 | { 8 | /// 9 | /// No shuffleling 10 | /// 11 | Linear, 12 | 13 | /// 14 | /// Shuffle 15 | /// 16 | Shuffle 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "dotMorten.AllJoyn.DeviceProviders": "1.1.1", 4 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0", 5 | "Microsoft.Toolkit.Uwp.UI.Controls": "1.0.0" 6 | }, 7 | "frameworks": { 8 | "uap10.0": {} 9 | }, 10 | "runtimes": { 11 | "win10-arm": {}, 12 | "win10-arm-aot": {}, 13 | "win10-x86": {}, 14 | "win10-x86-aot": {}, 15 | "win10-x64": {}, 16 | "win10-x64-aot": {} 17 | } 18 | } -------------------------------------------------------------------------------- /src/AllJoynDeviceLib/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "dotMorten.AllJoyn.DeviceProviders": "1.1.1", 4 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0", 5 | "StyleCop.Analyzers": { 6 | "version": "1.0.0", 7 | "suppressParent": "all" 8 | } 9 | }, 10 | "frameworks": { 11 | "uap10.0": {} 12 | }, 13 | "runtimes": { 14 | "win10-arm": {}, 15 | "win10-arm-aot": {}, 16 | "win10-x86": {}, 17 | "win10-x86-aot": {}, 18 | "win10-x64": {}, 19 | "win10-x64-aot": {} 20 | } 21 | } -------------------------------------------------------------------------------- /src/AllJoynDeviceLib/Devices/AllPlay/LoopMode.cs: -------------------------------------------------------------------------------- 1 | namespace AllJoynClientLib.Devices.AllPlay 2 | { 3 | /// 4 | /// Playlist loop mode 5 | /// 6 | public enum LoopMode 7 | { 8 | /// 9 | /// Don't loop 10 | /// 11 | None, 12 | 13 | /// 14 | /// Repeat the current track 15 | /// 16 | One, 17 | 18 | /// 19 | /// Repeat the entire playlist 20 | /// 21 | All 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/AllJoynDeviceLib/Devices/AllPlay/ZoneChangedEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace AllJoynClientLib.Devices.AllPlay 2 | { 3 | /// 4 | /// Event args for the event. 5 | /// 6 | /// 7 | public sealed class ZoneChangedEventArgs : System.EventArgs 8 | { 9 | /* 10 | 11 | 12 | 13 | */ 14 | } 15 | } -------------------------------------------------------------------------------- /src/AllJoynDeviceLib/Devices/AllPlay/PlayerReadyEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace AllJoynClientLib.Devices.AllPlay 2 | { 3 | /// 4 | /// Event args for the event. 5 | /// 6 | public class PlayerReadyEventArgs 7 | { 8 | internal PlayerReadyEventArgs(ulong resumeLatency) 9 | { 10 | ResumeLatency = resumeLatency; 11 | } 12 | 13 | /// 14 | /// Gets the resume latency. 15 | /// 16 | /// The resume latency. 17 | public ulong ResumeLatency { get; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/AllJoynDeviceLib/Devices/AllPlay/MediaState.cs: -------------------------------------------------------------------------------- 1 | namespace AllJoynClientLib.Devices.AllPlay 2 | { 3 | /// 4 | /// MediaState enumeration 5 | /// 6 | public enum MediaState 7 | { 8 | /// 9 | /// Stopped 10 | /// 11 | Stopped, 12 | 13 | /// 14 | /// Transitioning between tracks 15 | /// 16 | Transitioning, 17 | 18 | /// 19 | /// Buffering 20 | /// 21 | Buffering, 22 | 23 | /// 24 | /// Playing 25 | /// 26 | Playing 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/AllJoynDeviceLib/Devices/AllPlay/SlaveStateEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace AllJoynClientLib.Devices.AllPlay 2 | { 3 | /// 4 | /// The state of a slave player 5 | /// 6 | /// 7 | public class SlaveStateEventArgs : System.EventArgs 8 | { 9 | // TODO 10 | /* 11 | 12 | 13 | 14 | 15 | 16 | 17 | * */ 18 | } 19 | } -------------------------------------------------------------------------------- /src/AllJoynDeviceLib/stylecop.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", 3 | "settings": { 4 | "documentationRules": { 5 | "companyName": "Morten Nielsen", 6 | "copyrightText": "Copyright (c) {companyName}. All Rights Reserved", 7 | "documentInternalElements": false, 8 | "documentExposedElements": false 9 | }, 10 | "orderingRules": { 11 | "elementOrder": [ 12 | "constant" 13 | ], 14 | "usingDirectivesPlacement": "outsideNamespace" 15 | }, 16 | "indentation": { 17 | "indentationSize": 4, 18 | "tabSize": 4, 19 | "useTabs": false 20 | }, 21 | "readabilityRules": { 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Converters/BoolToCollapsedConverter.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.Xaml; 7 | using Windows.UI.Xaml.Data; 8 | 9 | namespace AllJoynSampleApp.Converters 10 | { 11 | public class BoolToCollapsedConverter : IValueConverter 12 | { 13 | public object Convert(object value, Type targetType, object parameter, string language) 14 | { 15 | if(value is bool) 16 | { 17 | return (bool)value ? Visibility.Collapsed : Visibility.Visible; 18 | } 19 | return Visibility.Visible; 20 | } 21 | 22 | public object ConvertBack(object value, Type targetType, object parameter, string language) 23 | { 24 | throw new NotImplementedException(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/AboutPage.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/AllJoynDeviceLib/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1117:Parameters must be on same line or separate lines", Justification = "Reviewed")] 2 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:Prefix local calls with this", Justification = "Following .NET Coding Guidelines")] 3 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1309:Field names must not begin with underscore", Justification = ".NET Coding Guidelines uses underscore obn private fields")] 4 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1128:Put constructor initializers on their own line", Justification = "Reviewed")] 5 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1633:File must have header", Justification = "Reviewed")] -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Converters/TimeSpanConverter.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.Xaml.Data; 7 | 8 | namespace AllJoynSampleApp.Converters 9 | { 10 | public class TimeSpanConverter : IValueConverter 11 | { 12 | public object Convert(object value, Type targetType, object parameter, string language) 13 | { 14 | if(value is TimeSpan) 15 | { 16 | var ts = (TimeSpan)value; 17 | if (ts.Hours > 0) 18 | return ts.ToString("h\\:mm\\:ss"); 19 | else 20 | return ts.ToString("m\\:ss"); 21 | } 22 | return value; 23 | } 24 | 25 | public object ConvertBack(object value, Type targetType, object parameter, string language) 26 | { 27 | throw new NotImplementedException(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Nuget/dotMorten.AllJoyn.AllJoynClientLib.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | dotMorten.AllJoyn.AllJoynClientLib 5 | 1.1.0 6 | AllJoyn Device Client Library 7 | Morten Nielsen 8 | Morten Nielsen 9 | https://github.com/dotMorten/AllJoynClientLib 10 | false 11 | An Universal Windows apps (UWP) Device Client Library for various common AllJoyn devices. 12 | For the Universal Windows Platform (Windows 10). 13 | Copyright (c) Microsoft Corporation. All rights reserved. 14 | AllJoyn IOT C# C++ Windows UWP UAP Universal Platform 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/AllJoynDeviceLib/Devices/AllPlay/PlaybackErrorEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using DeviceProviders; 5 | 6 | namespace AllJoynClientLib.Devices.AllPlay 7 | { 8 | /// 9 | /// Event argument for the event. 10 | /// 11 | public sealed class PlaybackErrorEventArgs : EventArgs 12 | { 13 | internal PlaybackErrorEventArgs(IList args) 14 | { 15 | Index = (int)args[0]; 16 | Error = args[1] as string; 17 | Description = args[2] as string; 18 | } 19 | 20 | /// 21 | /// Gets the index in the playlist for which this error occured 22 | /// 23 | public int Index { get; } 24 | 25 | /// 26 | /// Gets the error message 27 | /// 28 | public string Error { get; } 29 | 30 | /// 31 | /// Gets a description of the error 32 | /// 33 | public string Description { get; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/AllJoynDeviceLib/Devices/AllPlay/Playlist.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using DeviceProviders; 4 | 5 | namespace AllJoynClientLib.Devices.AllPlay 6 | { 7 | /// 8 | /// A media playlist 9 | /// 10 | public class Playlist 11 | { 12 | internal Playlist(IList result) 13 | { 14 | var items = result[0] as IList; 15 | Items = items.Select(i => new Media(i as AllJoynMessageArgStructure)); 16 | ControllerType = result[1] as string; 17 | PlaylistUserData = result[2] as string; 18 | } 19 | 20 | /// 21 | /// Gets the items in the playlist. 22 | /// 23 | public IEnumerable Items { get; } 24 | 25 | /// 26 | /// Gets a user-defined string to identify the controller type. 27 | /// 28 | public string ControllerType { get; } 29 | 30 | /// 31 | /// Gets the user-defined data 32 | /// 33 | public string PlaylistUserData { get; } 34 | } 35 | } -------------------------------------------------------------------------------- /src/AllJoynSampleApp/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("AllJoynSampleApp")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("AllJoynSampleApp")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 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/AllJoynDeviceLib/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("AllJoynClientLib")] 8 | [assembly: AssemblyDescription("https://github.com/dotMorten/AllJoynClientLib")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("Morten Nielsen")] 11 | [assembly: AssemblyProduct("AllJoynClientLib")] 12 | [assembly: AssemblyCopyright("Copyright © Morten Nielsen 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Version information for an assembly consists of the following four values: 17 | // 18 | // Major Version 19 | // Minor Version 20 | // Build Number 21 | // Revision 22 | // 23 | // You can specify all the values or you can default the Build and Revision Numbers 24 | // by using the '*' as shown below: 25 | // [assembly: AssemblyVersion("1.0.*")] 26 | [assembly: AssemblyVersion("1.1.0.0")] 27 | [assembly: AssemblyFileVersion("1.1.0.0")] 28 | [assembly: ComVisible(false)] -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Controls/TemplatePickerContentControl.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.Xaml; 7 | using Windows.UI.Xaml.Controls; 8 | 9 | namespace AllJoynSampleApp.Controls 10 | { 11 | public class TemplatePickerContentControl : ContentControl 12 | { 13 | protected override void OnContentTemplateSelectorChanged(DataTemplateSelector oldContentTemplateSelector, DataTemplateSelector newContentTemplateSelector) 14 | { 15 | base.OnContentTemplateSelectorChanged(oldContentTemplateSelector, newContentTemplateSelector); 16 | } 17 | 18 | public DataTemplateSelector ItemTemplateSelector 19 | { 20 | get { return (DataTemplateSelector)GetValue(ItemTemplateSelectorProperty); } 21 | set { SetValue(ItemTemplateSelectorProperty, value); } 22 | } 23 | 24 | public static readonly DependencyProperty ItemTemplateSelectorProperty = 25 | DependencyProperty.Register("ItemTemplateSelector", typeof(DataTemplateSelector), typeof(TemplatePickerContentControl), new PropertyMetadata(null)); 26 | 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/ViewModels/SwitchVM.cs: -------------------------------------------------------------------------------- 1 | using AllJoynClientLib.Devices; 2 | using System.Threading.Tasks; 3 | 4 | namespace AllJoynSampleApp.ViewModels 5 | { 6 | public class SwitchVM : DeviceVMBase 7 | { 8 | public SwitchVM(SwitchClient client) : base(client) 9 | { 10 | } 11 | 12 | protected override async Task Initialize() 13 | { 14 | Client.Toggled += Client_Toggled; 15 | _isOn = await Client.GetOnOffAsync(); 16 | OnPropertyChanged(nameof(IsOn)); 17 | } 18 | 19 | protected internal override void Unload() 20 | { 21 | Client.Toggled -= Client_Toggled; 22 | base.Unload(); 23 | } 24 | 25 | private void Client_Toggled(object sender, bool e) 26 | { 27 | _isOn = e; 28 | OnPropertyChanged(nameof(IsOn)); 29 | } 30 | 31 | private bool _isOn; 32 | 33 | public bool IsOn 34 | { 35 | get { return _isOn; } 36 | set 37 | { 38 | _isOn = value; 39 | OnPropertyChanged(); 40 | var _ = Client.SetOnOffAsync(value); 41 | } 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /src/AllJoynSampleApp/ViewModels/PhilipsHueBridgeVM.cs: -------------------------------------------------------------------------------- 1 | using AllJoynClientLib.Devices; 2 | using System.Threading.Tasks; 3 | 4 | namespace AllJoynSampleApp.ViewModels 5 | { 6 | public class PhilipsHueBridgeVM : DeviceVMBase 7 | { 8 | public PhilipsHueBridgeVM(DevicePlugins.PhilipsHueDSB client) : base(client) 9 | { 10 | LinkCommand = new GenericCommand(async (obj) => 11 | { 12 | LinkResult = ""; //clear last result 13 | OnPropertyChanged(nameof(LinkResult)); 14 | LinkResult = await Client.LinkAsync(); //link hub 15 | OnPropertyChanged(nameof(LinkResult)); 16 | IsLinked = await Client.GetIsLinkedAsync(); //update islinked property 17 | OnPropertyChanged(nameof(IsLinked)); 18 | }); 19 | } 20 | 21 | protected override async Task Initialize() 22 | { 23 | IsLinked = await Client.GetIsLinkedAsync(); 24 | OnPropertyChanged(nameof(IsLinked)); 25 | } 26 | 27 | public bool IsLinked { get; private set; } 28 | 29 | public System.Windows.Input.ICommand LinkCommand { get; } 30 | 31 | public string LinkResult { get; private set; } 32 | } 33 | } -------------------------------------------------------------------------------- /src/AllJoynSampleApp/ViewModels/CurrentHumidityVM.cs: -------------------------------------------------------------------------------- 1 | using AllJoynClientLib.Devices; 2 | using AllJoynClientLib.Devices.SmartSpaces; 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | namespace AllJoynSampleApp.ViewModels 7 | { 8 | public class CurrentHumidityVM : DeviceVMBase 9 | { 10 | public CurrentHumidityVM(CurrentHumidityClient client) : base(client) 11 | { 12 | } 13 | 14 | protected override async Task Initialize() 15 | { 16 | _currentValue = await Client.GetCurrentValueAsync(); 17 | OnPropertyChanged(nameof(Humidity)); 18 | Client.CurrentValueChanged += Client_CurrentValueChanged; 19 | } 20 | protected internal override void Unload() 21 | { 22 | Client.CurrentValueChanged -= Client_CurrentValueChanged; 23 | base.Unload(); 24 | } 25 | 26 | private void Client_CurrentValueChanged(object sender, double e) 27 | { 28 | _currentValue = e; 29 | OnPropertyChanged(nameof(Humidity)); 30 | } 31 | 32 | private double _currentValue; 33 | 34 | public string Humidity 35 | { 36 | get { 37 | return $"{_currentValue}%"; } 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /src/AllJoynSampleApp/ViewModels/GenericCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Linq; 5 | using System.Runtime.CompilerServices; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | using System.Windows.Input; 9 | 10 | namespace AllJoynSampleApp.ViewModels 11 | { 12 | internal class GenericCommand : ICommand 13 | { 14 | Action _execute; 15 | Func _canExecute; 16 | public GenericCommand(Action execute) : this((object o)=> { execute(); }, null) { } 17 | public GenericCommand(Action execute, Func canExecute = null) 18 | { 19 | _execute = execute; 20 | _canExecute = canExecute; 21 | } 22 | public event EventHandler CanExecuteChanged; 23 | 24 | public void RaiseCanExecuteChanged() 25 | { 26 | if(_canExecute != null) 27 | CanExecuteChanged?.Invoke(this, EventArgs.Empty); 28 | } 29 | public bool CanExecute(object parameter) 30 | { 31 | if (_canExecute == null) return true; 32 | return _canExecute(parameter); 33 | } 34 | 35 | public void Execute(object parameter) 36 | { 37 | _execute(parameter); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/AboutPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.Foundation; 7 | using Windows.Foundation.Collections; 8 | using Windows.UI.Xaml; 9 | using Windows.UI.Xaml.Controls; 10 | using Windows.UI.Xaml.Controls.Primitives; 11 | using Windows.UI.Xaml.Data; 12 | using Windows.UI.Xaml.Input; 13 | using Windows.UI.Xaml.Media; 14 | using Windows.UI.Xaml.Navigation; 15 | 16 | // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 17 | 18 | namespace AllJoynSampleApp 19 | { 20 | /// 21 | /// An empty page that can be used on its own or navigated to within a Frame. 22 | /// 23 | public sealed partial class AboutPage : Page 24 | { 25 | public AboutPage() 26 | { 27 | this.InitializeComponent(); 28 | LoadRtf(); 29 | } 30 | 31 | private async void LoadRtf() 32 | { 33 | var file = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appx:///AboutText.rtf")); 34 | using (var s = await file.OpenReadAsync()) 35 | reb.Document.LoadFromStream(Windows.UI.Text.TextSetOptions.FormatRtf, s); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/DeviceViews/SwitchClientView.xaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/DeviceViews/SwitchClientView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.Foundation; 7 | using Windows.Foundation.Collections; 8 | using Windows.UI.Xaml; 9 | using Windows.UI.Xaml.Controls; 10 | using Windows.UI.Xaml.Controls.Primitives; 11 | using Windows.UI.Xaml.Data; 12 | using Windows.UI.Xaml.Input; 13 | using Windows.UI.Xaml.Media; 14 | using Windows.UI.Xaml.Navigation; 15 | 16 | // The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 17 | 18 | namespace AllJoynSampleApp.DeviceViews 19 | { 20 | public sealed partial class SwitchClientView : Page 21 | { 22 | public SwitchClientView() 23 | { 24 | this.InitializeComponent(); 25 | } 26 | protected override void OnNavigatedTo(NavigationEventArgs e) 27 | { 28 | base.OnNavigatedTo(e); 29 | VM = new ViewModels.SwitchVM(e.Parameter as AllJoynClientLib.Devices.SwitchClient); 30 | } 31 | 32 | protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) 33 | { 34 | VM.Unload(); 35 | base.OnNavigatingFrom(e); 36 | } 37 | 38 | public ViewModels.SwitchVM VM { get; private set; } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Properties/Default.rd.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/DeviceViews/PhilipsHueBridgeView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.Foundation; 7 | using Windows.Foundation.Collections; 8 | using Windows.UI.Xaml; 9 | using Windows.UI.Xaml.Controls; 10 | using Windows.UI.Xaml.Controls.Primitives; 11 | using Windows.UI.Xaml.Data; 12 | using Windows.UI.Xaml.Input; 13 | using Windows.UI.Xaml.Media; 14 | using Windows.UI.Xaml.Navigation; 15 | 16 | // The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 17 | 18 | namespace AllJoynSampleApp.DeviceViews 19 | { 20 | public sealed partial class PhilipsHueBridgeView : Page 21 | { 22 | public PhilipsHueBridgeView() 23 | { 24 | this.InitializeComponent(); 25 | } 26 | protected override void OnNavigatedTo(NavigationEventArgs e) 27 | { 28 | base.OnNavigatedTo(e); 29 | VM = new ViewModels.PhilipsHueBridgeVM(e.Parameter as DevicePlugins.PhilipsHueDSB); 30 | } 31 | 32 | protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) 33 | { 34 | VM.Unload(); 35 | base.OnNavigatingFrom(e); 36 | } 37 | 38 | public ViewModels.PhilipsHueBridgeVM VM { get; private set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/DeviceViews/HumidityClientView.xaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/DeviceViews/TemperatureClientVIew.xaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/DeviceViews/HumidityClientView.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.Foundation; 7 | using Windows.Foundation.Collections; 8 | using Windows.UI.Xaml; 9 | using Windows.UI.Xaml.Controls; 10 | using Windows.UI.Xaml.Controls.Primitives; 11 | using Windows.UI.Xaml.Data; 12 | using Windows.UI.Xaml.Input; 13 | using Windows.UI.Xaml.Media; 14 | using Windows.UI.Xaml.Navigation; 15 | 16 | // The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 17 | 18 | namespace AllJoynSampleApp.DeviceViews 19 | { 20 | public sealed partial class HumidityClientView : Page 21 | { 22 | public HumidityClientView() 23 | { 24 | this.InitializeComponent(); 25 | } 26 | protected override void OnNavigatedTo(NavigationEventArgs e) 27 | { 28 | base.OnNavigatedTo(e); 29 | VM = new ViewModels.CurrentHumidityVM(e.Parameter as AllJoynClientLib.Devices.SmartSpaces.CurrentHumidityClient); 30 | } 31 | 32 | protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) 33 | { 34 | VM.Unload(); 35 | base.OnNavigatingFrom(e); 36 | } 37 | 38 | public ViewModels.CurrentHumidityVM VM { get; private set; } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/ViewModels/CurrentTemperatureVM.cs: -------------------------------------------------------------------------------- 1 | using AllJoynClientLib.Devices; 2 | using AllJoynClientLib.Devices.SmartSpaces; 3 | using System; 4 | using System.Threading.Tasks; 5 | 6 | namespace AllJoynSampleApp.ViewModels 7 | { 8 | public class CurrentTemperatureVM : DeviceVMBase 9 | { 10 | public CurrentTemperatureVM(CurrentTemperatureClient client) : base(client) 11 | { 12 | } 13 | 14 | protected override async Task Initialize() 15 | { 16 | _currentValue = await Client.GetCurrentValueAsync(); 17 | OnPropertyChanged(nameof(Temperature)); 18 | Client.CurrentValueChanged += Client_CurrentValueChanged; 19 | } 20 | protected internal override void Unload() 21 | { 22 | Client.CurrentValueChanged -= Client_CurrentValueChanged; 23 | base.Unload(); 24 | } 25 | 26 | private void Client_CurrentValueChanged(object sender, double e) 27 | { 28 | _currentValue = e; 29 | OnPropertyChanged(nameof(Temperature)); 30 | } 31 | 32 | private double _currentValue; 33 | 34 | public string Temperature 35 | { 36 | get { 37 | double fahrenheit = Math.Round((_currentValue) * 9d / 5d + 32, 1); 38 | return $"{_currentValue}⁰C\n{fahrenheit}⁰F"; } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /src/AllJoynSampleApp/DeviceViews/TemperatureClientVIew.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Runtime.InteropServices.WindowsRuntime; 6 | using Windows.Foundation; 7 | using Windows.Foundation.Collections; 8 | using Windows.UI.Xaml; 9 | using Windows.UI.Xaml.Controls; 10 | using Windows.UI.Xaml.Controls.Primitives; 11 | using Windows.UI.Xaml.Data; 12 | using Windows.UI.Xaml.Input; 13 | using Windows.UI.Xaml.Media; 14 | using Windows.UI.Xaml.Navigation; 15 | 16 | // The User Control item template is documented at http://go.microsoft.com/fwlink/?LinkId=234236 17 | 18 | namespace AllJoynSampleApp.DeviceViews 19 | { 20 | public sealed partial class TemperatureClientView : Page 21 | { 22 | public TemperatureClientView() 23 | { 24 | this.InitializeComponent(); 25 | } 26 | protected override void OnNavigatedTo(NavigationEventArgs e) 27 | { 28 | base.OnNavigatedTo(e); 29 | VM = new ViewModels.CurrentTemperatureVM(e.Parameter as AllJoynClientLib.Devices.SmartSpaces.CurrentTemperatureClient); 30 | } 31 | 32 | protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) 33 | { 34 | VM.Unload(); 35 | base.OnNavigatingFrom(e); 36 | } 37 | public ViewModels.CurrentTemperatureVM VM { get; private set; } 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/Converters/BoolToVisibilityConverter.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.Xaml; 7 | using Windows.UI.Xaml.Data; 8 | 9 | namespace AllJoynSampleApp.Converters 10 | { 11 | public class BoolToCollapsedConverter : IValueConverter 12 | { 13 | public object Convert(object value, Type targetType, object parameter, string language) 14 | { 15 | if(value is bool) 16 | { 17 | return (bool)value ? Visibility.Collapsed : Visibility.Visible; 18 | } 19 | return Visibility.Visible; 20 | } 21 | 22 | public object ConvertBack(object value, Type targetType, object parameter, string language) 23 | { 24 | throw new NotImplementedException(); 25 | } 26 | } 27 | public class BoolToVisibilityConverter : IValueConverter 28 | { 29 | public object Convert(object value, Type targetType, object parameter, string language) 30 | { 31 | if (value is bool) 32 | { 33 | return (bool)value ? Visibility.Visible : Visibility.Collapsed; 34 | } 35 | return Visibility.Visible; 36 | } 37 | 38 | public object ConvertBack(object value, Type targetType, object parameter, string language) 39 | { 40 | throw new NotImplementedException(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/DevicePlugins/PhilipsHueDSB.cs: -------------------------------------------------------------------------------- 1 | using AllJoynClientLib.Devices; 2 | using DeviceProviders; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace AllJoynSampleApp.DevicePlugins 10 | { 11 | // A custom device plugin for the Philips Hue Device Service Bridge 12 | // See https://github.com/dotMorten/AllJoynPhilipsHueDSB 13 | public class PhilipsHueDSB : DeviceClient 14 | { 15 | public static void Register() 16 | { 17 | AllJoynClientLib.DeviceManager.RegisterClient("com.dotMorten.PhilipsHueDSB.PhilipsHue.MainInterface", (service) => { return new PhilipsHueDSB(service); }); 18 | } 19 | 20 | private IInterface mainInterface; 21 | private IInterface hueInterface; 22 | 23 | public PhilipsHueDSB(DeviceProviders.IService service) : base(service) 24 | { 25 | mainInterface = GetInterface("com.dotMorten.PhilipsHueDSB.PhilipsHue.MainInterface"); 26 | hueInterface = GetInterface("com.dotMorten.PhilipsHueDSB.PhilipsHue"); 27 | } 28 | 29 | public Task GetIsLinkedAsync() 30 | { 31 | return hueInterface.GetPropertyAsync("IsLinked"); 32 | } 33 | 34 | public async Task LinkAsync() 35 | { 36 | var result = await mainInterface.InvokeMethodAsync("Link"); 37 | return result.First() as string; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/AllJoynSampleApp/DeviceViews/PhilipsHueBridgeView.xaml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |