├── .gitattributes
├── .gitignore
├── BigRedButton
├── BigRedButton.sln
└── BigRedButton
│ ├── App.config
│ ├── App.xaml
│ ├── App.xaml.cs
│ ├── AudioManager.cs
│ ├── BigRedButton.csproj
│ ├── BleButtonService.cs
│ ├── BleDeviceWatcher.cs
│ ├── BleGenericGattService.cs
│ ├── Images
│ ├── microphone.png
│ └── mute.png
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
│ └── packages.config
├── LICENSE
├── README.md
└── SensorTag
├── Artwork
├── AppTileIcon.png
├── screenshot_07152015_010545.png
├── screenshot_07152015_010652.png
├── wp_ss_20141230_0001.png
├── wp_ss_20141230_0002.png
├── wp_ss_20141230_0003.png
├── wp_ss_20141230_0004.png
├── wp_ss_20141230_0005.png
├── wp_ss_20141230_0006.png
├── wp_ss_20141230_0007.png
└── wp_ss_20141230_0008.png
├── SensorTag.Universal
├── App.xaml
├── App.xaml.cs
├── ApplicationInsights.config
├── Assets
│ ├── Accelerometer.png
│ ├── Barometer.png
│ ├── Buttons.png
│ ├── Compass.png
│ ├── Eye.png
│ ├── Gyroscope.png
│ ├── Humidity.png
│ ├── IRTemperature.png
│ ├── LockScreenLogo.scale-200.png
│ ├── SensorTag.png
│ ├── SplashScreen.scale-200.png
│ ├── Square150x150Logo.scale-200.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── StoreLogo.png
│ ├── Wide310x150Logo.scale-200.png
│ └── ti-sensortag-cc2650.png
├── MainPage.xaml
├── MainPage.xaml.cs
├── Package.StoreAssociation.xml
├── Package.appxmanifest
├── Properties
│ ├── AssemblyInfo.cs
│ └── Default.rd.xml
├── SensorTag.Universal.csproj
├── SensorTag.Universal_TemporaryKey.pfx
└── project.json
├── SensorTag.Windows
├── App.xaml
├── App.xaml.cs
├── Assets
│ ├── Accelerometer.png
│ ├── Barometer.png
│ ├── Buttons.png
│ ├── Compass.png
│ ├── Eye.png
│ ├── Gyroscope.png
│ ├── Humidity.png
│ ├── IRTemperature.png
│ ├── Logo.scale-100.png
│ ├── SensorTag.png
│ ├── SmallLogo.scale-100.png
│ ├── SplashScreen.scale-100.png
│ ├── StoreLogo.scale-100.png
│ └── ti-sensortag-cc2650.png
├── Common
│ └── StandardStyles.xaml
├── MainPage.xaml
├── MainPage.xaml.cs
├── Package.StoreAssociation.xml
├── Package.appxmanifest
├── Properties
│ └── AssemblyInfo.cs
├── SensorTag.Windows.csproj
├── SensorTag.Windows_StoreKey.pfx
└── SensorTag.Windows_TemporaryKey.pfx
├── SensorTag.sln
├── SensorTag
├── App.xaml
├── App.xaml.cs
├── Assets
│ ├── Accelerometer.png
│ ├── Barometer.png
│ ├── Buttons.png
│ ├── Compass.png
│ ├── Eye.png
│ ├── Gyroscope.png
│ ├── Humidity.png
│ ├── IRTemperature.png
│ ├── Logo.png
│ ├── Logo71.png
│ ├── SensorTag.png
│ ├── SmallLogo.png
│ ├── SplashScreen.png
│ ├── StoreLogo.png
│ ├── WideLogo.png
│ └── ti-sensortag-cc2650.png
├── Common
│ └── StandardStyles.xaml
├── MainPage.xaml
├── MainPage.xaml.cs
├── Package.StoreAssociation.xml
├── Package.appxmanifest
├── Properties
│ └── AssemblyInfo.cs
└── SensorTag.csproj
├── SensorTagLibrary
├── BleAccelerometerService.cs
├── BleBarometerService.cs
├── BleBatteryLevelService.cs
├── BleButtonService.cs
├── BleGenericGattService.cs
├── BleGyroscopeService.cs
├── BleHumidityService.cs
├── BleIRTemperatureService.cs
├── BleLightIntensityService.cs
├── BleMagnetometerService.cs
├── BleMovementService.cs
├── Properties
│ └── AssemblyInfo.cs
├── SensorTag.cs
└── SensorTagLibrary.csproj
└── SharedControls
├── Assets
├── SensorTag.png
└── ti-sensortag-cc2650.png
├── Controls
├── CompassControl.xaml
├── CompassControl.xaml.cs
├── EditableTextBlock.xaml
├── EditableTextBlock.xaml.cs
├── EmptyStringVisibilityConverter.cs
├── ScrollingGraph.xaml
├── ScrollingGraph.xaml.cs
├── TileControl.xaml
├── TileControl.xaml.cs
├── TileModel.cs
└── TiltContentControl.cs
├── Helpers
├── AnimationHelper.cs
├── ConversionExtensions.cs
├── IWindowVisibilityWatcher.cs
├── IsolatedStorage.cs
├── Settings.cs
└── XamlHelpers.cs
├── Pages
├── AccelerometerPage.xaml
├── AccelerometerPage.xaml.cs
├── ButtonPage.xaml
├── ButtonPage.xaml.cs
├── DeviceList.xaml
├── DeviceList.xaml.cs
├── DevicePage.xaml
├── DevicePage.xaml.cs
├── GyroPage.xaml
├── GyroPage.xaml.cs
├── HumidityPage.xaml
├── HumidityPage.xaml.cs
├── IRTemperaturePage.xaml
├── IRTemperaturePage.xaml.cs
├── LightPage.xaml
├── LightPage.xaml.cs
├── MagnetometerPage.xaml
├── MagnetometerPage.xaml.cs
├── PressurePage.xaml
└── PressurePage.xaml.cs
├── Properties
└── AssemblyInfo.cs
└── SharedControls.csproj
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.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 |
9 | # Build results
10 | [Dd]ebug/
11 | [Dd]ebugPublic/
12 | [Rr]elease/
13 | [Rr]eleases/
14 | x64/
15 | x86/
16 | build/
17 | bld/
18 | [Bb]in/
19 | [Oo]bj/
20 |
21 | # Roslyn cache directories
22 | *.ide/
23 |
24 | # MSTest test Results
25 | [Tt]est[Rr]esult*/
26 | [Bb]uild[Ll]og.*
27 |
28 | #NUNIT
29 | *.VisualState.xml
30 | TestResult.xml
31 |
32 | # Build Results of an ATL Project
33 | [Dd]ebugPS/
34 | [Rr]eleasePS/
35 | dlldata.c
36 |
37 | *_i.c
38 | *_p.c
39 | *_i.h
40 | *.ilk
41 | *.meta
42 | *.obj
43 | *.pch
44 | *.pdb
45 | *.pgc
46 | *.pgd
47 | *.rsp
48 | *.sbr
49 | *.tlb
50 | *.tli
51 | *.tlh
52 | *.tmp
53 | *.tmp_proj
54 | *.log
55 | *.vspscc
56 | *.vssscc
57 | .builds
58 | *.pidb
59 | *.svclog
60 | *.scc
61 |
62 | # Chutzpah Test files
63 | _Chutzpah*
64 |
65 | # Visual C++ cache files
66 | ipch/
67 | *.aps
68 | *.ncb
69 | *.opensdf
70 | *.sdf
71 | *.cachefile
72 |
73 | # Visual Studio profiler
74 | *.psess
75 | *.vsp
76 | *.vspx
77 |
78 | # TFS 2012 Local Workspace
79 | $tf/
80 |
81 | # Guidance Automation Toolkit
82 | *.gpState
83 |
84 | # ReSharper is a .NET coding add-in
85 | _ReSharper*/
86 | *.[Rr]e[Ss]harper
87 | *.DotSettings.user
88 |
89 | # JustCode is a .NET coding addin-in
90 | .JustCode
91 |
92 | # TeamCity is a build add-in
93 | _TeamCity*
94 |
95 | # DotCover is a Code Coverage Tool
96 | *.dotCover
97 |
98 | # NCrunch
99 | _NCrunch_*
100 | .*crunch*.local.xml
101 |
102 | # MightyMoose
103 | *.mm.*
104 | AutoTest.Net/
105 |
106 | # Web workbench (sass)
107 | .sass-cache/
108 |
109 | # Installshield output folder
110 | [Ee]xpress/
111 |
112 | # DocProject is a documentation generator add-in
113 | DocProject/buildhelp/
114 | DocProject/Help/*.HxT
115 | DocProject/Help/*.HxC
116 | DocProject/Help/*.hhc
117 | DocProject/Help/*.hhk
118 | DocProject/Help/*.hhp
119 | DocProject/Help/Html2
120 | DocProject/Help/html
121 |
122 | # Click-Once directory
123 | publish/
124 |
125 | # Publish Web Output
126 | *.[Pp]ublish.xml
127 | *.azurePubxml
128 | # TODO: Comment the next line if you want to checkin your web deploy settings
129 | # but database connection strings (with potential passwords) will be unencrypted
130 | *.pubxml
131 | *.publishproj
132 |
133 | # NuGet Packages
134 | *.nupkg
135 | # The packages folder can be ignored because of Package Restore
136 | **/packages/*
137 | # except build/, which is used as an MSBuild target.
138 | !**/packages/build/
139 | # If using the old MSBuild-Integrated Package Restore, uncomment this:
140 | #!**/packages/repositories.config
141 |
142 | # Windows Azure Build Output
143 | csx/
144 | *.build.csdef
145 |
146 | # Windows Store app package directory
147 | AppPackages/
148 |
149 | # Others
150 | sql/
151 | *.Cache
152 | ClientBin/
153 | [Ss]tyle[Cc]op.*
154 | ~$*
155 | *~
156 | *.dbmdl
157 | *.dbproj.schemaview
158 | *.pfx
159 | *.publishsettings
160 | node_modules/
161 |
162 | # RIA/Silverlight projects
163 | Generated_Code/
164 |
165 | # Backup & report files from converting an old project file
166 | # to a newer Visual Studio version. Backup files are not needed,
167 | # because we have git ;-)
168 | _UpgradeReport_Files/
169 | Backup*/
170 | UpgradeLog*.XML
171 | UpgradeLog*.htm
172 |
173 | # SQL Server files
174 | *.mdf
175 | *.ldf
176 |
177 | # Business Intelligence projects
178 | *.rdl.data
179 | *.bim.layout
180 | *.bim_*.settings
181 |
182 | # Microsoft Fakes
183 | FakesAssemblies/
184 |
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30523.141
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BigRedButton", "BigRedButton\BigRedButton.csproj", "{8999738A-DFC6-4BBF-BC16-D952FDD65331}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {8999738A-DFC6-4BBF-BC16-D952FDD65331}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {8999738A-DFC6-4BBF-BC16-D952FDD65331}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {8999738A-DFC6-4BBF-BC16-D952FDD65331}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {8999738A-DFC6-4BBF-BC16-D952FDD65331}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {603CB24C-B797-4D67-8AF1-BDFC3BF81C03}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace BigRedButton
10 | {
11 | ///
12 | /// Interaction logic for App.xaml
13 | ///
14 | public partial class App : Application
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/BigRedButton.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Debug
7 | AnyCPU
8 | {8999738A-DFC6-4BBF-BC16-D952FDD65331}
9 | WinExe
10 | BigRedButton
11 | BigRedButton
12 | v4.6.1
13 | 512
14 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
15 | 4
16 | true
17 | true
18 |
19 |
20 |
21 |
22 | AnyCPU
23 | true
24 | full
25 | false
26 | bin\Debug\
27 | DEBUG;TRACE
28 | prompt
29 | 4
30 |
31 |
32 | AnyCPU
33 | pdbonly
34 | true
35 | bin\Release\
36 | TRACE
37 | prompt
38 | 4
39 |
40 |
41 |
42 | 4.7.1
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | 4.0
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | MSBuild:Compile
63 | Designer
64 |
65 |
66 | MSBuild:Compile
67 | Designer
68 |
69 |
70 | App.xaml
71 | Code
72 |
73 |
74 |
75 |
76 |
77 |
78 | MainWindow.xaml
79 | Code
80 |
81 |
82 |
83 |
84 | Code
85 |
86 |
87 | True
88 | True
89 | Resources.resx
90 |
91 |
92 | True
93 | Settings.settings
94 | True
95 |
96 |
97 | ResXFileCodeGenerator
98 | Resources.Designer.cs
99 |
100 |
101 |
102 | SettingsSingleFileGenerator
103 | Settings.Designer.cs
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/BleButtonService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Windows.Devices.Bluetooth.GenericAttributeProfile;
8 | using Windows.Devices.Enumeration;
9 | using Windows.Storage.Streams;
10 | using Buffer = Windows.Storage.Streams.Buffer;
11 |
12 | namespace SensorTag
13 | {
14 | ///
15 | /// This class provides access to the SensorTag button (key) data.
16 | ///
17 | public class BleButtonService : BleGenericGattService
18 | {
19 |
20 | public BleButtonService()
21 | {
22 | }
23 |
24 | ///
25 | /// The version of the SensorTag device. 1=CC2541, 2=CC2650.
26 | ///
27 | public int Version { get; set; }
28 |
29 |
30 | public static Guid ButtonServiceUuid = Guid.Parse("0000ffe0-0000-1000-8000-00805f9b34fb");
31 | public static Guid ButtonCharacteristicUuid = Guid.Parse("0000ffe1-0000-1000-8000-00805f9b34fb");
32 |
33 | Delegate _buttonValueChanged;
34 |
35 | public event EventHandler ButtonValueChanged
36 | {
37 | add
38 | {
39 | if (_buttonValueChanged != null)
40 | {
41 | _buttonValueChanged = Delegate.Combine(_buttonValueChanged, value);
42 | }
43 | else
44 | {
45 | _buttonValueChanged = value;
46 | RegisterForValueChangeEvents(ButtonCharacteristicUuid);
47 | }
48 | }
49 | remove
50 | {
51 | if (_buttonValueChanged != null)
52 | {
53 | _buttonValueChanged = Delegate.Remove(_buttonValueChanged, value);
54 | if (_buttonValueChanged == null)
55 | {
56 | UnregisterForValueChangeEvents(ButtonCharacteristicUuid);
57 | }
58 | }
59 | }
60 | }
61 |
62 | private void OnButtonValueChanged(SensorButtonEventArgs args)
63 | {
64 | if (_buttonValueChanged != null)
65 | {
66 | ((EventHandler)_buttonValueChanged)(this, args);
67 | }
68 | }
69 |
70 | public async Task ConnectAsync(string deviceContainerId)
71 | {
72 | return await this.ConnectAsync(ButtonServiceUuid, deviceContainerId);
73 | }
74 |
75 | protected override void OnCharacteristicValueChanged(GattCharacteristic sender, GattValueChangedEventArgs eventArgs)
76 | {
77 | if (sender.Uuid == ButtonCharacteristicUuid)
78 | {
79 | if (_buttonValueChanged != null)
80 | {
81 | uint dataLength = eventArgs.CharacteristicValue.Length;
82 | using (DataReader reader = DataReader.FromBuffer(eventArgs.CharacteristicValue))
83 | {
84 | if (dataLength == 1)
85 | {
86 | byte bits = reader.ReadByte();
87 |
88 | OnButtonValueChanged(new SensorButtonEventArgs(bits, eventArgs.Timestamp));
89 | }
90 | }
91 | }
92 | }
93 | }
94 |
95 | }
96 |
97 |
98 | public class SensorButtonEventArgs : EventArgs
99 | {
100 | private byte bits;
101 |
102 | public SensorButtonEventArgs(byte bits, DateTimeOffset timestamp)
103 | {
104 | this.bits = bits;
105 | Timestamp = timestamp;
106 | }
107 |
108 | public bool LeftButtonDown
109 | {
110 | get { return (bits & 0x2) == 0x2; }
111 | }
112 |
113 | public bool RightButtonDown
114 | {
115 | get { return (bits & 0x1) == 0x1; }
116 | }
117 |
118 | public DateTimeOffset Timestamp
119 | {
120 | get;
121 | private set;
122 | }
123 | }
124 |
125 | }
126 |
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/BleDeviceWatcher.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Windows.Devices.Bluetooth.GenericAttributeProfile;
8 | using Windows.Devices.Enumeration;
9 |
10 | namespace BigRedButton
11 | {
12 | class BleDeviceWatcher
13 | {
14 | DeviceWatcher watcher;
15 |
16 | public void StartWatching(Guid gattServiceUuid)
17 | {
18 | var selector = GattDeviceService.GetDeviceSelectorFromUuid(gattServiceUuid);
19 | watcher = DeviceInformation.CreateWatcher(selector);
20 | watcher.Added += OnDeviceAdded;
21 | watcher.Removed += OnDeviceRemoved;
22 | }
23 |
24 | private void OnDeviceRemoved(DeviceWatcher sender, DeviceInformationUpdate args)
25 | {
26 | Debug.WriteLine("Device removed: {0}", args.Id);
27 | }
28 |
29 | private void OnDeviceAdded(DeviceWatcher sender, DeviceInformation args)
30 | {
31 | Debug.WriteLine("Device added: {0}: {1}", args.Name, args.Id);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/Images/microphone.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/BigRedButton/BigRedButton/Images/microphone.png
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/Images/mute.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/BigRedButton/BigRedButton/Images/mute.png
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using SensorTag;
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 | using System.Windows;
9 | using System.Windows.Controls;
10 | using System.Windows.Data;
11 | using System.Windows.Documents;
12 | using System.Windows.Input;
13 | using System.Windows.Media;
14 | using System.Windows.Media.Imaging;
15 | using System.Windows.Navigation;
16 | using System.Windows.Shapes;
17 | using Windows.Devices.Bluetooth;
18 | using Windows.Devices.Bluetooth.GenericAttributeProfile;
19 | using Windows.Devices.Enumeration;
20 |
21 | namespace BigRedButton
22 | {
23 | ///
24 | /// Interaction logic for MainWindow.xaml
25 | ///
26 | public partial class MainWindow : Window
27 | {
28 | BleButtonService buttons;
29 | BleDeviceWatcher watcher;
30 | bool muted;
31 |
32 | public MainWindow()
33 | {
34 | InitializeComponent();
35 | buttons = new BleButtonService();
36 | this.Loaded += OnWindowLoaded;
37 | watcher = new BleDeviceWatcher();
38 | watcher.StartWatching(Guid.Parse("f000aa00-0451-4000-b000-000000000000"));
39 | }
40 |
41 | private async void OnWindowLoaded(object sender, RoutedEventArgs e)
42 | {
43 | if (AudioManager.IsMute())
44 | {
45 | muted = true;
46 | }
47 | UpdateMicIcon();
48 | await FindPairedDevices();
49 | }
50 |
51 | public async Task FindPairedDevices()
52 | {
53 | foreach (var info in await DeviceInformation.FindAllAsync(GattDeviceService.GetDeviceSelectorFromUuid(GattServiceUuids.DeviceInformation)))
54 | {
55 | if (info.Name == "SensorTag 2.0")
56 | {
57 | Debug.WriteLine("Found device: {0}: {1}", info.Name, info.Id);
58 | string containerId = info.Properties[BleGenericGattService.CONTAINER_ID_PROPERTY_NAME]?.ToString();
59 | await this.ConnectButtonsAsync(containerId);
60 | }
61 | }
62 | }
63 |
64 | private async Task ConnectButtonsAsync(string containerId)
65 | {
66 | Debug.WriteLine("connecting...");
67 | await buttons.ConnectAsync(containerId);
68 | buttons.ButtonValueChanged += OnButtonValueChanged;
69 | }
70 |
71 | bool leftButtonDown;
72 | bool rightButtonDown;
73 |
74 | private void OnButtonValueChanged(object sender, SensorButtonEventArgs e)
75 | {
76 | leftButtonDown = e.LeftButtonDown;
77 | rightButtonDown = e.RightButtonDown;
78 | Debug.WriteLine("Button state: left={0}, right={1}", e.LeftButtonDown, e.RightButtonDown);
79 | this.Dispatcher.Invoke(OnUpdateButtons);
80 | }
81 |
82 | private void OnUpdateButtons()
83 | {
84 | if (leftButtonDown)
85 | {
86 | if (AudioManager.SetMute(!muted) == 0)
87 | {
88 | muted = !muted;
89 | UpdateMicIcon();
90 | }
91 | }
92 |
93 | if (rightButtonDown)
94 | {
95 | RightButton.Background = Brushes.Green;
96 | }
97 | else
98 | {
99 | RightButton.SetValue(Button.BackgroundProperty, DependencyProperty.UnsetValue);
100 | }
101 | }
102 |
103 | void UpdateMicIcon()
104 | {
105 | if (muted)
106 | {
107 | MicOn.Visibility = Visibility.Collapsed;
108 | MicOff.Visibility = Visibility.Visible;
109 | }
110 | else
111 | {
112 | MicOn.Visibility = Visibility.Visible;
113 | MicOff.Visibility = Visibility.Collapsed;
114 | }
115 | }
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Resources;
3 | using System.Runtime.CompilerServices;
4 | using System.Runtime.InteropServices;
5 | using System.Windows;
6 |
7 | // General Information about an assembly is controlled through the following
8 | // set of attributes. Change these attribute values to modify the information
9 | // associated with an assembly.
10 | [assembly: AssemblyTitle("BigRedButton")]
11 | [assembly: AssemblyDescription("")]
12 | [assembly: AssemblyConfiguration("")]
13 | [assembly: AssemblyCompany("")]
14 | [assembly: AssemblyProduct("BigRedButton")]
15 | [assembly: AssemblyCopyright("Copyright © 2020")]
16 | [assembly: AssemblyTrademark("")]
17 | [assembly: AssemblyCulture("")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 | [assembly: ComVisible(false)]
23 |
24 | //In order to begin building localizable applications, set
25 | //CultureYouAreCodingWith in your .csproj file
26 | //inside a . For example, if you are using US english
27 | //in your source files, set the to en-US. Then uncomment
28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
29 | //the line below to match the UICulture setting in the project file.
30 |
31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
32 |
33 |
34 | [assembly: ThemeInfo(
35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
36 | //(used if a resource is not found in the page,
37 | // or application resource dictionaries)
38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
39 | //(used if a resource is not found in the page,
40 | // app, or any theme specific resource dictionaries)
41 | )]
42 |
43 |
44 | // Version information for an assembly consists of the following four values:
45 | //
46 | // Major Version
47 | // Minor Version
48 | // Build Number
49 | // Revision
50 | //
51 | // You can specify all the values or you can default the Build and Revision Numbers
52 | // by using the '*' as shown below:
53 | // [assembly: AssemblyVersion("1.0.*")]
54 | [assembly: AssemblyVersion("1.0.0.0")]
55 | [assembly: AssemblyFileVersion("1.0.0.0")]
56 |
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace BigRedButton.Properties
12 | {
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources
26 | {
27 |
28 | private static global::System.Resources.ResourceManager resourceMan;
29 |
30 | private static global::System.Globalization.CultureInfo resourceCulture;
31 |
32 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
33 | internal Resources()
34 | {
35 | }
36 |
37 | ///
38 | /// Returns the cached ResourceManager instance used by this class.
39 | ///
40 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
41 | internal static global::System.Resources.ResourceManager ResourceManager
42 | {
43 | get
44 | {
45 | if ((resourceMan == null))
46 | {
47 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BigRedButton.Properties.Resources", typeof(Resources).Assembly);
48 | resourceMan = temp;
49 | }
50 | return resourceMan;
51 | }
52 | }
53 |
54 | ///
55 | /// Overrides the current thread's CurrentUICulture property for all
56 | /// resource lookups using this strongly typed resource class.
57 | ///
58 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
59 | internal static global::System.Globalization.CultureInfo Culture
60 | {
61 | get
62 | {
63 | return resourceCulture;
64 | }
65 | set
66 | {
67 | resourceCulture = value;
68 | }
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace BigRedButton.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/BigRedButton/BigRedButton/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | SensorTag-for-Windows
2 | =====================
3 |
4 | Sample code that talks to Texus Instruments SensorTag Bluetooth LE device for Windows Universal Apps. This code supports both versions CC2541 and CC2650
5 |
6 | First pair your SensorTag with your Windows 8.1 device, then this app will automatically connect to it and show you all the data.
7 |
8 | The SensorTagLibrary code is the part that is designed to be reused in your apps, it provides most of the bluetooth characteristic data available on the SensorTag.
9 |
10 |
11 |
--------------------------------------------------------------------------------
/SensorTag/Artwork/AppTileIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/Artwork/AppTileIcon.png
--------------------------------------------------------------------------------
/SensorTag/Artwork/screenshot_07152015_010545.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/Artwork/screenshot_07152015_010545.png
--------------------------------------------------------------------------------
/SensorTag/Artwork/screenshot_07152015_010652.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/Artwork/screenshot_07152015_010652.png
--------------------------------------------------------------------------------
/SensorTag/Artwork/wp_ss_20141230_0001.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/Artwork/wp_ss_20141230_0001.png
--------------------------------------------------------------------------------
/SensorTag/Artwork/wp_ss_20141230_0002.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/Artwork/wp_ss_20141230_0002.png
--------------------------------------------------------------------------------
/SensorTag/Artwork/wp_ss_20141230_0003.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/Artwork/wp_ss_20141230_0003.png
--------------------------------------------------------------------------------
/SensorTag/Artwork/wp_ss_20141230_0004.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/Artwork/wp_ss_20141230_0004.png
--------------------------------------------------------------------------------
/SensorTag/Artwork/wp_ss_20141230_0005.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/Artwork/wp_ss_20141230_0005.png
--------------------------------------------------------------------------------
/SensorTag/Artwork/wp_ss_20141230_0006.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/Artwork/wp_ss_20141230_0006.png
--------------------------------------------------------------------------------
/SensorTag/Artwork/wp_ss_20141230_0007.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/Artwork/wp_ss_20141230_0007.png
--------------------------------------------------------------------------------
/SensorTag/Artwork/wp_ss_20141230_0008.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/Artwork/wp_ss_20141230_0008.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/App.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.ApplicationModel;
7 | using Windows.ApplicationModel.Activation;
8 | using Windows.Foundation;
9 | using Windows.Foundation.Collections;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Controls.Primitives;
13 | using Windows.UI.Xaml.Data;
14 | using Windows.UI.Xaml.Input;
15 | using Windows.UI.Xaml.Media;
16 | using Windows.UI.Xaml.Navigation;
17 |
18 | namespace SensorTag
19 | {
20 | ///
21 | /// Provides application-specific behavior to supplement the default Application class.
22 | ///
23 | sealed partial class App : Application
24 | {
25 | ///
26 | /// Initializes the singleton application object. This is the first line of authored code
27 | /// executed, and as such is the logical equivalent of main() or WinMain().
28 | ///
29 | public App()
30 | {
31 | Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
32 | Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
33 | Microsoft.ApplicationInsights.WindowsCollectors.Session);
34 | this.InitializeComponent();
35 | this.Suspending += OnSuspending;
36 | }
37 |
38 | ///
39 | /// Invoked when the application is launched normally by the end user. Other entry points
40 | /// will be used such as when the application is launched to open a specific file.
41 | ///
42 | /// Details about the launch request and process.
43 | protected override void OnLaunched(LaunchActivatedEventArgs e)
44 | {
45 |
46 | #if DEBUG
47 | if (System.Diagnostics.Debugger.IsAttached)
48 | {
49 | this.DebugSettings.EnableFrameRateCounter = true;
50 | }
51 | #endif
52 |
53 | Frame rootFrame = Window.Current.Content as Frame;
54 |
55 | // Do not repeat app initialization when the Window already has content,
56 | // just ensure that the window is active
57 | if (rootFrame == null)
58 | {
59 | // Create a Frame to act as the navigation context and navigate to the first page
60 | rootFrame = new Frame();
61 |
62 | rootFrame.NavigationFailed += OnNavigationFailed;
63 |
64 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
65 | {
66 | //TODO: Load state from previously suspended application
67 | }
68 |
69 | // Place the frame in the current Window
70 | Window.Current.Content = rootFrame;
71 | }
72 |
73 | if (rootFrame.Content == null)
74 | {
75 | // When the navigation stack isn't restored navigate to the first page,
76 | // configuring the new page by passing required information as a navigation
77 | // parameter
78 | rootFrame.Navigate(typeof(MainPage), e.Arguments);
79 | }
80 | // Ensure the current window is active
81 | Window.Current.Activate();
82 | }
83 |
84 | ///
85 | /// Invoked when Navigation to a certain page fails
86 | ///
87 | /// The Frame which failed navigation
88 | /// Details about the navigation failure
89 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
90 | {
91 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
92 | }
93 |
94 | ///
95 | /// Invoked when application execution is being suspended. Application state is saved
96 | /// without knowing whether the application will be terminated or resumed with the contents
97 | /// of memory still intact.
98 | ///
99 | /// The source of the suspend request.
100 | /// Details about the suspend request.
101 | private void OnSuspending(object sender, SuspendingEventArgs e)
102 | {
103 | var deferral = e.SuspendingOperation.GetDeferral();
104 | //TODO: Save application state and stop any background activity
105 | deferral.Complete();
106 | }
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/ApplicationInsights.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/Accelerometer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/Accelerometer.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/Barometer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/Barometer.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/Buttons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/Buttons.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/Compass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/Compass.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/Eye.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/Eye.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/Gyroscope.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/Gyroscope.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/Humidity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/Humidity.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/IRTemperature.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/IRTemperature.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/SensorTag.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/SensorTag.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Assets/ti-sensortag-cc2650.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/Assets/ti-sensortag-cc2650.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/MainPage.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=402352&clcid=0x409
17 |
18 | namespace SensorTag
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 MainPage : Page
24 | {
25 | public MainPage()
26 | {
27 | this.InitializeComponent();
28 | }
29 |
30 | ///
31 | /// Invoked when this page is about to be displayed in a Frame.
32 | ///
33 | /// Event data that describes how this page was reached. The Parameter
34 | /// property is typically used to configure the page.
35 | protected override void OnNavigatedTo(NavigationEventArgs e)
36 | {
37 | base.OnNavigatedTo(e);
38 | SensorTagPanel.Show();
39 | }
40 |
41 | protected override void OnNavigatedFrom(Windows.UI.Xaml.Navigation.NavigationEventArgs e)
42 | {
43 | base.OnNavigatedFrom(e);
44 | SensorTagPanel.Hide();
45 | }
46 |
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | SensorTag
7 | Chris Lovett
8 | Assets\StoreLogo.png
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/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("SensorTag.Universal")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SensorTag.Universal")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
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)]
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/Properties/Default.rd.xml:
--------------------------------------------------------------------------------
1 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/SensorTag.Universal_TemporaryKey.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Universal/SensorTag.Universal_TemporaryKey.pfx
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Universal/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "Microsoft.ApplicationInsights": "1.0.0",
4 | "Microsoft.ApplicationInsights.PersistenceChannel": "1.0.0",
5 | "Microsoft.ApplicationInsights.WindowsApps": "1.0.0",
6 | "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0"
7 | },
8 | "frameworks": {
9 | "uap10.0": {}
10 | },
11 | "runtimes": {
12 | "win10-arm": {},
13 | "win10-arm-aot": {},
14 | "win10-x86": {},
15 | "win10-x86-aot": {},
16 | "win10-x64": {},
17 | "win10-x64-aot": {}
18 | }
19 | }
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/App.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.ApplicationModel;
7 | using Windows.ApplicationModel.Activation;
8 | using Windows.Foundation;
9 | using Windows.Foundation.Collections;
10 | using Windows.UI.Xaml;
11 | using Windows.UI.Xaml.Controls;
12 | using Windows.UI.Xaml.Controls.Primitives;
13 | using Windows.UI.Xaml.Data;
14 | using Windows.UI.Xaml.Input;
15 | using Windows.UI.Xaml.Media;
16 | using Windows.UI.Xaml.Navigation;
17 |
18 | // The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
19 |
20 | namespace SensorTag
21 | {
22 | ///
23 | /// Provides application-specific behavior to supplement the default Application class.
24 | ///
25 | sealed partial class App : Application
26 | {
27 | Settings _settings;
28 | SensorTag _sensor;
29 |
30 | ///
31 | /// Initializes the singleton application object. This is the first line of authored code
32 | /// executed, and as such is the logical equivalent of main() or WinMain().
33 | ///
34 | public App()
35 | {
36 | this.InitializeComponent();
37 | this.Suspending += OnSuspending;
38 | }
39 |
40 | ///
41 | /// The selected SensorTag device
42 | ///
43 | public SensorTag SensorTag
44 | {
45 | get { return _sensor; }
46 | set { _sensor = value; }
47 | }
48 |
49 | ///
50 | /// Invoked when the application is launched normally by the end user. Other entry points
51 | /// will be used such as when the application is launched to open a specific file.
52 | ///
53 | /// Details about the launch request and process.
54 | protected async override void OnLaunched(LaunchActivatedEventArgs e)
55 | {
56 | _settings = await Settings.LoadAsync();
57 | if (_settings == null)
58 | {
59 | _settings = new Settings();
60 | await _settings.SaveAsync();
61 | }
62 |
63 | Frame rootFrame = Window.Current.Content as Frame;
64 |
65 | // Do not repeat app initialization when the Window already has content,
66 | // just ensure that the window is active
67 | if (rootFrame == null)
68 | {
69 | // Create a Frame to act as the navigation context and navigate to the first page
70 | rootFrame = new Frame();
71 | // Set the default language
72 | rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
73 |
74 | rootFrame.NavigationFailed += OnNavigationFailed;
75 |
76 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
77 | {
78 | //TODO: Load state from previously suspended application
79 | }
80 |
81 | // Place the frame in the current Window
82 | Window.Current.Content = rootFrame;
83 | }
84 |
85 | if (rootFrame.Content == null)
86 | {
87 | // When the navigation stack isn't restored navigate to the first page,
88 | // configuring the new page by passing required information as a navigation
89 | // parameter
90 | rootFrame.Navigate(typeof(MainPage), e.Arguments);
91 | }
92 | // Ensure the current window is active
93 | Window.Current.Activate();
94 | }
95 |
96 | ///
97 | /// Invoked when Navigation to a certain page fails
98 | ///
99 | /// The Frame which failed navigation
100 | /// Details about the navigation failure
101 | void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
102 | {
103 | throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
104 | }
105 |
106 | ///
107 | /// Invoked when application execution is being suspended. Application state is saved
108 | /// without knowing whether the application will be terminated or resumed with the contents
109 | /// of memory still intact.
110 | ///
111 | /// The source of the suspend request.
112 | /// Details about the suspend request.
113 | private void OnSuspending(object sender, SuspendingEventArgs e)
114 | {
115 | var deferral = e.SuspendingOperation.GetDeferral();
116 | //TODO: Save application state and stop any background activity
117 | deferral.Complete();
118 | }
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/Assets/Accelerometer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/Assets/Accelerometer.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/Assets/Barometer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/Assets/Barometer.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/Assets/Buttons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/Assets/Buttons.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/Assets/Compass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/Assets/Compass.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/Assets/Eye.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/Assets/Eye.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/Assets/Gyroscope.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/Assets/Gyroscope.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/Assets/Humidity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/Assets/Humidity.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/Assets/IRTemperature.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/Assets/IRTemperature.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/Assets/Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/Assets/Logo.scale-100.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/Assets/SensorTag.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/Assets/SensorTag.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/Assets/SmallLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/Assets/SmallLogo.scale-100.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/Assets/SplashScreen.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/Assets/SplashScreen.scale-100.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/Assets/StoreLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/Assets/StoreLogo.scale-100.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/Assets/ti-sensortag-cc2650.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/Assets/ti-sensortag-cc2650.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using Windows.UI.Xaml.Controls;
2 | using Windows.UI.Xaml.Navigation;
3 |
4 | // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
5 |
6 | namespace SensorTag
7 | {
8 | ///
9 | /// An empty page that can be used on its own or navigated to within a Frame.
10 | ///
11 | public sealed partial class MainPage : Page
12 | {
13 | public MainPage()
14 | {
15 | this.InitializeComponent();
16 | }
17 |
18 |
19 | ///
20 | /// Invoked when this page is about to be displayed in a Frame.
21 | ///
22 | /// Event data that describes how this page was reached. The Parameter
23 | /// property is typically used to configure the page.
24 | protected override void OnNavigatedTo(NavigationEventArgs e)
25 | {
26 | base.OnNavigatedTo(e);
27 | SensorTagPanel.Show();
28 | }
29 |
30 | protected override void OnNavigatedFrom(Windows.UI.Xaml.Navigation.NavigationEventArgs e)
31 | {
32 | base.OnNavigatedFrom(e);
33 | SensorTagPanel.Hide();
34 | }
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SensorTag
6 | Chris Lovett
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 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/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("SensorTag.Windows")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("SensorTag.Windows")]
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)]
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/SensorTag.Windows_StoreKey.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/SensorTag.Windows_StoreKey.pfx
--------------------------------------------------------------------------------
/SensorTag/SensorTag.Windows/SensorTag.Windows_TemporaryKey.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag.Windows/SensorTag.Windows_TemporaryKey.pfx
--------------------------------------------------------------------------------
/SensorTag/SensorTag/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
10 |
11 |
12 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag/App.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.ApplicationModel;
7 | using Windows.ApplicationModel.Activation;
8 | using Windows.Foundation;
9 | using Windows.Foundation.Collections;
10 | using Windows.Phone.UI.Input;
11 | using Windows.UI.Xaml;
12 | using Windows.UI.Xaml.Controls;
13 | using Windows.UI.Xaml.Controls.Primitives;
14 | using Windows.UI.Xaml.Data;
15 | using Windows.UI.Xaml.Input;
16 | using Windows.UI.Xaml.Media;
17 | using Windows.UI.Xaml.Navigation;
18 |
19 | // The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
20 |
21 | namespace SensorTag
22 | {
23 | ///
24 | /// Provides application-specific behavior to supplement the default Application class.
25 | ///
26 | sealed partial class App : Application
27 | {
28 | Settings _settings;
29 | SensorTag _sensor;
30 |
31 | ///
32 | /// Initializes the singleton application object. This is the first line of authored code
33 | /// executed, and as such is the logical equivalent of main() or WinMain().
34 | ///
35 | public App()
36 | {
37 | this.InitializeComponent();
38 | this.Suspending += OnSuspending;
39 | HardwareButtons.BackPressed += HardwareButtons_BackPressed;
40 |
41 | }
42 |
43 | ///
44 | /// The selected SensorTag device
45 | ///
46 | public SensorTag SensorTag
47 | {
48 | get { return _sensor; }
49 | set { _sensor = value; }
50 | }
51 |
52 |
53 | ///
54 | /// Handles back button press. If app is at the root page of app, don't go back and the
55 | /// system will suspend the app.
56 | ///
57 | /// The source of the BackPressed event.
58 | /// Details for the BackPressed event.
59 | private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
60 | {
61 | Frame frame = Window.Current.Content as Frame;
62 | if (frame == null)
63 | {
64 | return;
65 | }
66 |
67 | if (frame.CanGoBack)
68 | {
69 | frame.GoBack();
70 | e.Handled = true;
71 | }
72 | }
73 |
74 | ///
75 | /// Invoked when the application is launched normally by the end user. Other entry points
76 | /// will be used when the application is launched to open a specific file, to display
77 | /// search results, and so forth.
78 | ///
79 | /// Details about the launch request and process.
80 | protected async override void OnLaunched(LaunchActivatedEventArgs e)
81 | {
82 | Frame rootFrame = Window.Current.Content as Frame;
83 |
84 | _settings = await Settings.LoadAsync();
85 | if (_settings == null)
86 | {
87 | _settings = new Settings();
88 | await _settings.SaveAsync();
89 | }
90 |
91 | // Do not repeat app initialization when the Window already has content,
92 | // just ensure that the window is active
93 | if (rootFrame == null)
94 | {
95 | // Create a Frame to act as the navigation context and navigate to the first page
96 | rootFrame = new Frame();
97 |
98 | if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
99 | {
100 | //TODO: Load state from previously suspended application
101 | }
102 |
103 | // Place the frame in the current Window
104 | Window.Current.Content = rootFrame;
105 | }
106 |
107 | if (rootFrame.Content == null)
108 | {
109 | // When the navigation stack isn't restored navigate to the first page,
110 | // configuring the new page by passing required information as a navigation
111 | // parameter
112 | if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
113 | {
114 | throw new Exception("Failed to create initial page");
115 | }
116 | }
117 |
118 | // Ensure the current window is active
119 | Window.Current.Activate();
120 |
121 | // Make sure we are listening to this event
122 | Window.Current.VisibilityChanged -= OnWindowVisibilityChanged;
123 | Window.Current.VisibilityChanged += OnWindowVisibilityChanged;
124 |
125 | }
126 |
127 | private void OnWindowVisibilityChanged(object sender, Windows.UI.Core.VisibilityChangedEventArgs e)
128 | {
129 | Frame frame = Window.Current.Content as Frame;
130 | IWindowVisibilityWatcher watcher = frame.Content as IWindowVisibilityWatcher;
131 | if (watcher != null)
132 | {
133 | watcher.OnVisibilityChanged(e.Visible);
134 | }
135 |
136 | }
137 |
138 | ///
139 | /// Invoked when application execution is being suspended. Application state is saved
140 | /// without knowing whether the application will be terminated or resumed with the contents
141 | /// of memory still intact.
142 | ///
143 | /// The source of the suspend request.
144 | /// Details about the suspend request.
145 | private void OnSuspending(object sender, SuspendingEventArgs e)
146 | {
147 | var deferral = e.SuspendingOperation.GetDeferral();
148 | Window.Current.VisibilityChanged -= OnWindowVisibilityChanged;
149 | deferral.Complete();
150 | }
151 | }
152 | }
153 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/Accelerometer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/Accelerometer.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/Barometer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/Barometer.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/Buttons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/Buttons.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/Compass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/Compass.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/Eye.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/Eye.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/Gyroscope.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/Gyroscope.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/Humidity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/Humidity.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/IRTemperature.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/IRTemperature.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/Logo.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/Logo71.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/Logo71.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/SensorTag.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/SensorTag.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/SmallLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/SmallLogo.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/SplashScreen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/SplashScreen.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/WideLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/WideLogo.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Assets/ti-sensortag-cc2650.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SensorTag/Assets/ti-sensortag-cc2650.png
--------------------------------------------------------------------------------
/SensorTag/SensorTag/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using SensorTag.Controls;
2 | using SensorTag.Pages;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Diagnostics;
6 | using System.IO;
7 | using System.Linq;
8 | using System.Runtime.InteropServices.WindowsRuntime;
9 | using System.Threading.Tasks;
10 | using Windows.ApplicationModel.Core;
11 | using Windows.Devices.Bluetooth.GenericAttributeProfile;
12 | using Windows.Foundation;
13 | using Windows.Foundation.Collections;
14 | using Windows.UI.Core;
15 | using Windows.UI.Xaml;
16 | using Windows.UI.Xaml.Controls;
17 | using Windows.UI.Xaml.Controls.Primitives;
18 | using Windows.UI.Xaml.Data;
19 | using Windows.UI.Xaml.Input;
20 | using Windows.UI.Xaml.Media;
21 | using Windows.UI.Xaml.Media.Animation;
22 | using Windows.UI.Xaml.Media.Imaging;
23 | using Windows.UI.Xaml.Navigation;
24 |
25 | // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
26 |
27 | namespace SensorTag
28 | {
29 | ///
30 | /// An empty page that can be used on its own or navigated to within a Frame.
31 | ///
32 | public sealed partial class MainPage : Page
33 | {
34 | public MainPage()
35 | {
36 | this.InitializeComponent();
37 | }
38 |
39 | ///
40 | /// Invoked when this page is about to be displayed in a Frame.
41 | ///
42 | /// Event data that describes how this page was reached. The Parameter
43 | /// property is typically used to configure the page.
44 | protected override void OnNavigatedTo(NavigationEventArgs e)
45 | {
46 | base.OnNavigatedTo(e);
47 | SensorTagPanel.Show();
48 | }
49 |
50 | protected override void OnNavigatedFrom(Windows.UI.Xaml.Navigation.NavigationEventArgs e)
51 | {
52 | base.OnNavigatedFrom(e);
53 | SensorTagPanel.Hide();
54 | }
55 |
56 | }
57 |
58 | }
--------------------------------------------------------------------------------
/SensorTag/SensorTag/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | SensorTag
7 | Chris Lovett
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 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/SensorTag/SensorTag/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("SensorTag")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("Lovett Software")]
12 | [assembly: AssemblyProduct("SensorTag")]
13 | [assembly: AssemblyCopyright("Copyright Lovett Software © 2015")]
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.2.0.0")]
28 | [assembly: AssemblyFileVersion("1.2.0.0")]
29 | [assembly: ComVisible(false)]
--------------------------------------------------------------------------------
/SensorTag/SensorTag/SensorTag.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {75E5DCE6-8B90-4358-8D6D-0398550C2A0B}
8 | AppContainerExe
9 | Properties
10 | SensorTag
11 | SensorTag
12 | en-US
13 | 8.1
14 | 12
15 | 512
16 | {76F1466A-8B6D-4E39-A767-685A06062A39};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
17 | SAK
18 | SAK
19 | SAK
20 | SAK
21 | True
22 | neutral
23 |
24 |
25 | AnyCPU
26 | true
27 | full
28 | false
29 | bin\Debug\
30 | DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP
31 | prompt
32 | 4
33 |
34 |
35 | AnyCPU
36 | pdbonly
37 | true
38 | bin\Release\
39 | TRACE;NETFX_CORE;WINDOWS_PHONE_APP
40 | prompt
41 | 4
42 |
43 |
44 | true
45 | bin\ARM\Debug\
46 | DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP
47 | ;2008
48 | full
49 | ARM
50 | false
51 | prompt
52 | true
53 |
54 |
55 | bin\ARM\Release\
56 | TRACE;NETFX_CORE;WINDOWS_PHONE_APP
57 | true
58 | ;2008
59 | pdbonly
60 | ARM
61 | false
62 | prompt
63 | true
64 |
65 |
66 | true
67 | bin\x86\Debug\
68 | DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP
69 | ;2008
70 | full
71 | x86
72 | false
73 | prompt
74 | true
75 |
76 |
77 | bin\x86\Release\
78 | TRACE;NETFX_CORE;WINDOWS_PHONE_APP
79 | true
80 | ;2008
81 | pdbonly
82 | x86
83 | false
84 | prompt
85 | true
86 |
87 |
88 |
89 | App.xaml
90 |
91 |
92 | MainPage.xaml
93 |
94 |
95 |
96 |
97 |
98 | Designer
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 | MSBuild:Compile
123 | Designer
124 |
125 |
126 | MSBuild:Compile
127 | Designer
128 |
129 |
130 | MSBuild:Compile
131 | Designer
132 |
133 |
134 |
135 |
136 | {702df202-1cfe-456d-9df9-5e4e4daa02a4}
137 | SensorTagLibrary
138 |
139 |
140 | {F22119A4-141D-426E-8653-E41599E03099}
141 | SharedControls
142 |
143 |
144 |
145 | 12.0
146 |
147 |
148 | WindowsPhoneApp
149 |
150 |
151 |
158 |
--------------------------------------------------------------------------------
/SensorTag/SensorTagLibrary/BleBatteryLevelService.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.Devices.Bluetooth;
7 | using Windows.Devices.Bluetooth.GenericAttributeProfile;
8 | using Windows.Devices.Enumeration;
9 | using Windows.Storage.Streams;
10 |
11 | namespace SensorTag
12 | {
13 | public class BleBatteryLevelService : BleGenericGattService
14 | {
15 |
16 | public BleBatteryLevelService()
17 | {
18 | }
19 |
20 | public event EventHandler BatteryLevelMeasurementValueChanged;
21 |
22 | public async Task> FindMatchingDevices()
23 | {
24 | var devices = await DeviceInformation.FindAllAsync(GattDeviceService.GetDeviceSelectorFromUuid(
25 | GattCharacteristicUuids.BatteryLevel), new string[] {
26 | CONTAINER_ID_PROPERTY_NAME
27 | });
28 |
29 | List result = new List();
30 |
31 | foreach (DeviceInformation device in devices)
32 | {
33 | result.Add(new BleGattDeviceInfo(device));
34 | }
35 |
36 | return result;
37 | }
38 |
39 | private void OnBatteryLevelMeasurementValueChanged(BatteryLevelMeasurementEventArgs args)
40 | {
41 | if (BatteryLevelMeasurementValueChanged != null)
42 | {
43 | BatteryLevelMeasurementValueChanged(this, args);
44 | }
45 | }
46 |
47 | public async Task ConnectAsync(string deviceContainerId)
48 | {
49 | bool rc = await this.ConnectAsync(GattServiceUuids.Battery, deviceContainerId);
50 | if (rc)
51 | {
52 | this.RegisterForValueChangeEvents(GattCharacteristicUuids.BatteryLevel);
53 | }
54 | return rc;
55 | }
56 |
57 | protected override void OnCharacteristicValueChanged(GattCharacteristic sender, GattValueChangedEventArgs eventArgs)
58 | {
59 | if (sender.Uuid == GattCharacteristicUuids.BatteryLevel)
60 | {
61 | if (BatteryLevelMeasurementValueChanged != null)
62 | {
63 | byte level = 0;
64 |
65 | using (DataReader reader = DataReader.FromBuffer(eventArgs.CharacteristicValue))
66 | {
67 | level = reader.ReadByte();
68 | }
69 | OnBatteryLevelMeasurementValueChanged(new BatteryLevelMeasurementEventArgs() { BatteryLevel = level, Timestamp = eventArgs.Timestamp });
70 | }
71 | }
72 | }
73 |
74 | public async Task ReadBatteryLevelAsync(BluetoothCacheMode cacheMode = BluetoothCacheMode.Uncached)
75 | {
76 | GattStatus gattStatus = GattStatus.Unsupported;
77 |
78 | var batteryLevelCharacteristic = this.GetCharacteristic(GattCharacteristicUuids.BatteryLevel);
79 | if (batteryLevelCharacteristic == null)
80 | {
81 | gattStatus = GattStatus.UnknownCharacteristic;
82 | }
83 | else
84 | {
85 | GattReadResult readResult = await batteryLevelCharacteristic.ReadValueAsync(cacheMode);
86 | gattStatus = (GattStatus)readResult.Status;
87 | if (gattStatus == GattStatus.Success)
88 | {
89 | using (DataReader reader = DataReader.FromBuffer(readResult.Value))
90 | {
91 | return reader.ReadByte();
92 | }
93 | }
94 | }
95 |
96 | OnError("ReadBatteryLevelAsync:" + gattStatus.ToString());
97 | return 0;
98 | }
99 |
100 | }
101 |
102 |
103 | public class BatteryLevelMeasurementEventArgs : EventArgs
104 | {
105 |
106 | public byte BatteryLevel
107 | {
108 | get;
109 | set;
110 | }
111 |
112 | public DateTimeOffset Timestamp
113 | {
114 | get;
115 | set;
116 | }
117 | }
118 |
119 | }
120 |
--------------------------------------------------------------------------------
/SensorTag/SensorTagLibrary/BleButtonService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Windows.Devices.Bluetooth.GenericAttributeProfile;
8 | using Windows.Devices.Enumeration;
9 | using Windows.Storage.Streams;
10 | using Buffer = Windows.Storage.Streams.Buffer;
11 |
12 | namespace SensorTag
13 | {
14 | ///
15 | /// This class provides access to the SensorTag button (key) data.
16 | ///
17 | public class BleButtonService : BleGenericGattService
18 | {
19 |
20 | public BleButtonService()
21 | {
22 | }
23 |
24 | ///
25 | /// The version of the SensorTag device. 1=CC2541, 2=CC2650.
26 | ///
27 | public int Version { get; set; }
28 |
29 |
30 | public static Guid ButtonServiceUuid = Guid.Parse("0000ffe0-0000-1000-8000-00805f9b34fb");
31 | public static Guid ButtonCharacteristicUuid = Guid.Parse("0000ffe1-0000-1000-8000-00805f9b34fb");
32 |
33 | Delegate _buttonValueChanged;
34 |
35 | public event EventHandler ButtonValueChanged
36 | {
37 | add
38 | {
39 | if (_buttonValueChanged != null)
40 | {
41 | _buttonValueChanged = Delegate.Combine(_buttonValueChanged, value);
42 | }
43 | else
44 | {
45 | _buttonValueChanged = value;
46 | RegisterForValueChangeEvents(ButtonCharacteristicUuid);
47 | }
48 | }
49 | remove
50 | {
51 | if (_buttonValueChanged != null)
52 | {
53 | _buttonValueChanged = Delegate.Remove(_buttonValueChanged, value);
54 | if (_buttonValueChanged == null)
55 | {
56 | UnregisterForValueChangeEvents(ButtonCharacteristicUuid);
57 | }
58 | }
59 | }
60 | }
61 |
62 | private void OnButtonValueChanged(SensorButtonEventArgs args)
63 | {
64 | if (_buttonValueChanged != null)
65 | {
66 | ((EventHandler)_buttonValueChanged)(this, args);
67 | }
68 | }
69 |
70 | public async Task ConnectAsync(string deviceContainerId)
71 | {
72 | return await this.ConnectAsync(ButtonServiceUuid, deviceContainerId);
73 | }
74 |
75 | protected override void OnCharacteristicValueChanged(GattCharacteristic sender, GattValueChangedEventArgs eventArgs)
76 | {
77 | if (sender.Uuid == ButtonCharacteristicUuid)
78 | {
79 | if (_buttonValueChanged != null)
80 | {
81 | uint dataLength = eventArgs.CharacteristicValue.Length;
82 | using (DataReader reader = DataReader.FromBuffer(eventArgs.CharacteristicValue))
83 | {
84 | if (dataLength == 1)
85 | {
86 | byte bits = reader.ReadByte();
87 |
88 | OnButtonValueChanged(new SensorButtonEventArgs(bits, eventArgs.Timestamp));
89 | }
90 | }
91 | }
92 | }
93 | }
94 |
95 | }
96 |
97 |
98 | public class SensorButtonEventArgs : EventArgs
99 | {
100 | private byte bits;
101 |
102 | public SensorButtonEventArgs(byte bits, DateTimeOffset timestamp)
103 | {
104 | this.bits = bits;
105 | Timestamp = timestamp;
106 | }
107 |
108 | public bool LeftButtonDown
109 | {
110 | get { return (bits & 0x2) == 0x2; }
111 | }
112 |
113 | public bool RightButtonDown
114 | {
115 | get { return (bits & 0x1) == 0x1; }
116 | }
117 |
118 | public DateTimeOffset Timestamp
119 | {
120 | get;
121 | private set;
122 | }
123 | }
124 |
125 | }
126 |
--------------------------------------------------------------------------------
/SensorTag/SensorTagLibrary/BleGyroscopeService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Windows.Devices.Bluetooth.GenericAttributeProfile;
8 | using Windows.Devices.Enumeration;
9 | using Windows.Storage.Streams;
10 | using Buffer = Windows.Storage.Streams.Buffer;
11 |
12 | namespace SensorTag
13 | {
14 | public enum GyroscopeAxes
15 | {
16 | None = 0,
17 | X = 1,
18 | Y = 2,
19 | XY = 3,
20 | Z = 4,
21 | XZ = 5,
22 | YZ = 6,
23 | XYZ = 7
24 | }
25 |
26 | ///
27 | /// This class provides access to the SensorTag Gyroscope BLE data
28 | ///
29 | public class BleGyroscopeService : BleGenericGattService
30 | {
31 |
32 | public BleGyroscopeService()
33 | {
34 | }
35 |
36 | ///
37 | /// The version of the SensorTag device. 1=CC2541, 2=CC2650.
38 | ///
39 | public int Version { get; set; }
40 |
41 | static Guid GyroscopeServiceUuid = Guid.Parse("f000aa50-0451-4000-b000-000000000000");
42 | static Guid GyroscopeCharacteristicUuid = Guid.Parse("f000aa51-0451-4000-b000-000000000000");
43 | static Guid GyroscopeCharacteristicConfigUuid = Guid.Parse("f000aa52-0451-4000-b000-000000000000");
44 |
45 | Delegate _gyroscopeValueChanged;
46 |
47 | public event EventHandler GyroscopeMeasurementValueChanged
48 | {
49 | add
50 | {
51 | if (_gyroscopeValueChanged != null)
52 | {
53 | _gyroscopeValueChanged = Delegate.Combine(_gyroscopeValueChanged, value);
54 | }
55 | else
56 | {
57 | _gyroscopeValueChanged = value;
58 | RegisterForValueChangeEvents(GyroscopeCharacteristicUuid);
59 | }
60 | }
61 | remove
62 | {
63 | if (_gyroscopeValueChanged != null)
64 | {
65 | _gyroscopeValueChanged = Delegate.Remove(_gyroscopeValueChanged, value);
66 | if (_gyroscopeValueChanged == null)
67 | {
68 | UnregisterForValueChangeEvents(GyroscopeCharacteristicUuid);
69 | }
70 | }
71 | }
72 | }
73 |
74 | private async Task GetConfig()
75 | {
76 | var ch = GetCharacteristic(GyroscopeCharacteristicConfigUuid);
77 | if (ch != null)
78 | {
79 | var properties = ch.CharacteristicProperties;
80 |
81 | if ((properties & GattCharacteristicProperties.Read) != 0)
82 | {
83 | var result = await ch.ReadValueAsync();
84 | IBuffer buffer = result.Value;
85 | DataReader reader = DataReader.FromBuffer(buffer);
86 | var value = reader.ReadByte();
87 | Debug.WriteLine("Gyroscope config = " + value);
88 | return (int)value;
89 | }
90 | }
91 | return -1;
92 | }
93 |
94 |
95 | GyroscopeAxes readingAxes = GyroscopeAxes.None;
96 |
97 | ///
98 | /// Enable getting GyroscopeMeasurementValueChanged events on the given axes.
99 | /// The gyro produces new values about once per second and that period cannot be changed.
100 | ///
101 | ///
102 | public async Task StartReading(GyroscopeAxes enableAxes)
103 | {
104 | if (readingAxes != enableAxes)
105 | {
106 | byte value = (byte)enableAxes;
107 | await WriteCharacteristicByte(GyroscopeCharacteristicConfigUuid, value);
108 | readingAxes = enableAxes;
109 | }
110 | }
111 |
112 | public async Task StopReading()
113 | {
114 | if (readingAxes != GyroscopeAxes.None)
115 | {
116 | readingAxes = GyroscopeAxes.None;
117 | await WriteCharacteristicByte(GyroscopeCharacteristicConfigUuid, 0);
118 | }
119 | }
120 |
121 | private void OnGyroscopeMeasurementValueChanged(GyroscopeMeasurementEventArgs args)
122 | {
123 | if (_gyroscopeValueChanged != null)
124 | {
125 | ((EventHandler)_gyroscopeValueChanged)(this, args);
126 | }
127 | }
128 |
129 |
130 | public async Task ConnectAsync(string deviceContainerId)
131 | {
132 | return await this.ConnectAsync(GyroscopeServiceUuid, deviceContainerId);
133 | }
134 |
135 | protected override void OnCharacteristicValueChanged(GattCharacteristic sender, GattValueChangedEventArgs eventArgs)
136 | {
137 | if (sender.Uuid == GyroscopeCharacteristicUuid)
138 | {
139 | if (_gyroscopeValueChanged != null)
140 | {
141 | uint dataLength = eventArgs.CharacteristicValue.Length;
142 | using (DataReader reader = DataReader.FromBuffer(eventArgs.CharacteristicValue))
143 | {
144 | if (dataLength == 6)
145 | {
146 | short x = ReadBigEndian16bit(reader);
147 | short y = ReadBigEndian16bit(reader);
148 | short z = ReadBigEndian16bit(reader);
149 |
150 | GyroscopeMeasurement measurement = new GyroscopeMeasurement();
151 | measurement.X = ((double)x * 500.0) / 65536.0;
152 | measurement.Y = ((double)y * 500.0) / 65536.0;
153 | measurement.Z = ((double)z * 500.0) / 65536.0;
154 |
155 | OnGyroscopeMeasurementValueChanged(new GyroscopeMeasurementEventArgs(measurement, eventArgs.Timestamp));
156 | }
157 | }
158 | }
159 | }
160 | }
161 | }
162 |
163 |
164 | public class GyroscopeMeasurement
165 | {
166 | ///
167 | /// Get/Set X twist in degrees per second.
168 | ///
169 | public double X { get; set;}
170 |
171 | ///
172 | /// Get/Set Y twist in degrees per second.
173 | ///
174 | public double Y { get; set;}
175 |
176 | ///
177 | /// Get/Set Z twist in degrees per second.
178 | ///
179 | public double Z { get; set;}
180 |
181 | public GyroscopeMeasurement()
182 | {
183 | }
184 |
185 | }
186 |
187 | public class GyroscopeMeasurementEventArgs : EventArgs
188 | {
189 | public GyroscopeMeasurementEventArgs(GyroscopeMeasurement measurement, DateTimeOffset timestamp)
190 | {
191 | Measurement = measurement;
192 | Timestamp = timestamp;
193 | }
194 |
195 | public GyroscopeMeasurement Measurement
196 | {
197 | get;
198 | private set;
199 | }
200 |
201 | public DateTimeOffset Timestamp
202 | {
203 | get;
204 | private set;
205 | }
206 | }
207 |
208 | }
209 |
--------------------------------------------------------------------------------
/SensorTag/SensorTagLibrary/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("SensorTagLibrary")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("SensorTagLibrary")]
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.0.0")]
30 | [assembly: AssemblyFileVersion("1.0.0.0")]
31 |
--------------------------------------------------------------------------------
/SensorTag/SensorTagLibrary/SensorTagLibrary.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 12.0
6 | Debug
7 | AnyCPU
8 | {702DF202-1CFE-456D-9DF9-5E4E4DAA02A4}
9 | Library
10 | Properties
11 | SensorTagLibrary
12 | SensorTagLibrary
13 | en-US
14 | 512
15 | {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
16 | Profile32
17 | v4.6
18 | SAK
19 | SAK
20 | SAK
21 | SAK
22 |
23 |
24 | true
25 | full
26 | false
27 | bin\Debug\
28 | DEBUG;TRACE
29 | prompt
30 | 4
31 |
32 |
33 | pdbonly
34 | true
35 | bin\Release\
36 | TRACE
37 | prompt
38 | 4
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
70 |
--------------------------------------------------------------------------------
/SensorTag/SharedControls/Assets/SensorTag.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SharedControls/Assets/SensorTag.png
--------------------------------------------------------------------------------
/SensorTag/SharedControls/Assets/ti-sensortag-cc2650.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/clovett/SensorTag-for-Windows/efacb16530586296878deb074d5cc0921a1ba2d4/SensorTag/SharedControls/Assets/ti-sensortag-cc2650.png
--------------------------------------------------------------------------------
/SensorTag/SharedControls/Controls/CompassControl.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
23 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/SensorTag/SharedControls/Controls/CompassControl.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 SensorTag.Controls
19 | {
20 | public sealed partial class CompassControl : UserControl
21 | {
22 | const double HandWidth = 10;
23 |
24 | public CompassControl()
25 | {
26 | this.InitializeComponent();
27 | this.SizeChanged += CompassControl_SizeChanged;
28 | }
29 |
30 | void CompassControl_SizeChanged(object sender, SizeChangedEventArgs e)
31 | {
32 | double w = e.NewSize.Width;
33 | double h = e.NewSize.Height;
34 |
35 | // the top hand
36 | PathGeometry top = new PathGeometry();
37 | PathFigure f = new PathFigure() { StartPoint = new Point(HandWidth, 0), IsFilled = true };
38 | top.Figures.Add(f);
39 | f.Segments.Add(new LineSegment() { Point = new Point(0, h / 2) });
40 | f.Segments.Add(new LineSegment() { Point = new Point(-HandWidth, 0) });
41 | TopHand.Data = top;
42 |
43 | // the bottom hand
44 | PathGeometry bottom = new PathGeometry();
45 | f = new PathFigure() { StartPoint = new Point(HandWidth, 0), IsFilled = true };
46 | bottom.Figures.Add(f);
47 | f.Segments.Add(new LineSegment() { Point = new Point(0, -h / 2) });
48 | f.Segments.Add(new LineSegment() { Point = new Point(-HandWidth, 0) });
49 | BottomHand.Data = bottom;
50 |
51 | TranslateTransform.X = TranslateTransform.Y = h / 2;
52 | }
53 |
54 |
55 |
56 | public double Angle
57 | {
58 | get { return (double)GetValue(AngleProperty); }
59 | set { SetValue(AngleProperty, value); }
60 | }
61 |
62 | // Using a DependencyProperty as the backing store for Angle. This enables animation, styling, binding, etc...
63 | public static readonly DependencyProperty AngleProperty =
64 | DependencyProperty.Register("Angle", typeof(double), typeof(CompassControl), new PropertyMetadata(0d, new PropertyChangedCallback(OnAngleChanged)));
65 |
66 | private static void OnAngleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
67 | {
68 | ((CompassControl)d).OnAngleChanged();
69 | }
70 |
71 | void OnAngleChanged()
72 | {
73 | RotateTransform.Angle = this.Angle;
74 | }
75 |
76 |
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/SensorTag/SharedControls/Controls/EditableTextBlock.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
16 |
19 |
20 |
21 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/SensorTag/SharedControls/Controls/EditableTextBlock.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 SensorTag.Controls
19 | {
20 | public sealed partial class EditableTextBlock : UserControl
21 | {
22 | public EditableTextBlock()
23 | {
24 | this.InitializeComponent();
25 | }
26 |
27 |
28 | public string Label
29 | {
30 | get { return (string)GetValue(LabelProperty); }
31 | set { SetValue(LabelProperty, value); }
32 | }
33 |
34 | // Using a DependencyProperty as the backing store for Label. This enables animation, styling, binding, etc...
35 | public static readonly DependencyProperty LabelProperty =
36 | DependencyProperty.Register("Label", typeof(string), typeof(EditableTextBlock), new PropertyMetadata(null, new PropertyChangedCallback(OnLabelChanged)));
37 |
38 | private static void OnLabelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
39 | {
40 | ((EditableTextBlock)d).OnLabelChanged();
41 | }
42 |
43 | void OnLabelChanged()
44 | {
45 | LabelTextBlock.Text = LabelEditBox.Text = this.Label;
46 | if (LabelChanged != null)
47 | {
48 | LabelChanged(this, EventArgs.Empty);
49 | }
50 | }
51 |
52 | public event EventHandler LabelChanged;
53 |
54 |
55 | private void PageTitleEditBox_LostFocus(object sender, RoutedEventArgs e)
56 | {
57 | CommitEdit();
58 | }
59 |
60 | private void CommitEdit()
61 | {
62 | LabelTextBlock.Visibility = Windows.UI.Xaml.Visibility.Visible;
63 | LabelEditBox.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
64 | Label = LabelEditBox.Text;
65 | }
66 |
67 | private void PageTitleEditBox_KeyDown(object sender, KeyRoutedEventArgs e)
68 | {
69 | if (e.Key == Windows.System.VirtualKey.Enter)
70 | {
71 | e.Handled = true;
72 | CommitEdit();
73 | }
74 | }
75 |
76 | private void OnBorderPointerPressed(object sender, PointerRoutedEventArgs e)
77 | {
78 | BeginEdit();
79 | }
80 |
81 | public void BeginEdit()
82 | {
83 | LabelTextBlock.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
84 | LabelEditBox.Visibility = Windows.UI.Xaml.Visibility.Visible;
85 |
86 | var nowait = Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, new Windows.UI.Core.DispatchedHandler(() =>
87 | {
88 | LabelEditBox.SelectAll();
89 | LabelEditBox.Focus(Windows.UI.Xaml.FocusState.Programmatic);
90 | }));
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/SensorTag/SharedControls/Controls/EmptyStringVisibilityConverter.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 SensorTag.Controls
10 | {
11 | class EmptyStringVisibilityConverter : IValueConverter
12 | {
13 | public object Convert(object value, Type targetType, object parameter, string language)
14 | {
15 | string s = value == null ? null : value.ToString();
16 | return string.IsNullOrEmpty(s) ? Visibility.Collapsed : Visibility.Visible;
17 | }
18 |
19 | public object ConvertBack(object value, Type targetType, object parameter, string language)
20 | {
21 | throw new NotImplementedException();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/SensorTag/SharedControls/Controls/ScrollingGraph.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/SensorTag/SharedControls/Controls/TileControl.xaml:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/SensorTag/SharedControls/Controls/TileControl.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 SensorTag.Controls
19 | {
20 | public sealed partial class TileControl : UserControl
21 | {
22 | public TileControl()
23 | {
24 | this.InitializeComponent();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/SensorTag/SharedControls/Controls/TileModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Windows.UI.Xaml.Media;
8 |
9 | namespace SensorTag.Controls
10 | {
11 | public class TileModel : INotifyPropertyChanged
12 | {
13 | private ImageSource icon;
14 |
15 | public ImageSource Icon
16 | {
17 | get { return icon; }
18 | set
19 | {
20 | if (icon != value)
21 | {
22 | icon = value;
23 | OnPropertyChanged("Icon");
24 | }
25 | }
26 | }
27 |
28 | private string caption;
29 |
30 | public string Caption
31 | {
32 | get { return caption; }
33 | set
34 | {
35 | if (caption != value)
36 | {
37 | caption = value;
38 | OnPropertyChanged("Caption");
39 | }
40 | }
41 |
42 | }
43 |
44 | private string sensorValue;
45 |
46 | public string SensorValue
47 | {
48 | get { return sensorValue; }
49 | set
50 | {
51 | if (sensorValue != value)
52 | {
53 | sensorValue = value;
54 | OnPropertyChanged("SensorValue");
55 | }
56 | }
57 | }
58 |
59 | private object userData;
60 |
61 | public object UserData
62 | {
63 | get { return userData; }
64 | set
65 | {
66 | if (userData != value)
67 | {
68 | userData = value;
69 | OnPropertyChanged("UserData");
70 | }
71 | }
72 | }
73 |
74 |
75 | public event PropertyChangedEventHandler PropertyChanged;
76 |
77 | private void OnPropertyChanged(string name)
78 | {
79 | if (PropertyChanged != null)
80 | {
81 | PropertyChanged(this, new PropertyChangedEventArgs(name));
82 | }
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/SensorTag/SharedControls/Helpers/AnimationHelper.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.Media.Animation;
8 |
9 | namespace SensorTag
10 | {
11 | public static class AnimationHelper
12 | {
13 | public static Storyboard BeginAnimation(this UIElement element, Timeline animation, string targetProperty, EventHandler