├── Licence.txt ├── NfcNDefTagReader_Release_AnyCPU_v1_0.xap ├── NfcNdefTagReader.sln ├── NfcNdefTagReader ├── App.xaml ├── App.xaml.cs ├── Assets │ ├── Images │ │ ├── NFC-device-smaller.png │ │ ├── NFC-device-smaller_2.png │ │ ├── NFC-device.png │ │ └── NFC-device_2.png │ ├── NFC-device.png │ └── Tiles │ │ ├── NfcNdefTagReader-large.png │ │ ├── NfcNdefTagReader-medium.png │ │ └── NfcNdefTagReader-small.png ├── LocalizedStrings.cs ├── MainPage.xaml ├── MainPage.xaml.cs ├── NdefRecord.cs ├── NdefRecordTypeDefinitions.cs ├── NdefRecordUtility.cs ├── NfcNdefTagReader.csproj ├── NfcNdefTagReader.csproj.user ├── Properties │ ├── AppManifest.xml │ ├── AssemblyInfo.cs │ └── WMAppManifest.xml └── Resources │ ├── AppResources.Designer.cs │ └── AppResources.resx ├── README.md └── doc ├── app_icon.png ├── nfcndeftagreader-1.png ├── nfcndeftagreader-2.png └── nfcndeftagreader-uml-diagram.png /Licence.txt: -------------------------------------------------------------------------------- 1 | Copyright © 2012-2014 Microsoft Mobile Oy. All rights reserved. 2 | 3 | Microsoft is a registered trademark of Microsoft Corporation. Nokia and HERE are 4 | trademarks and/or registered trademarks of Nokia Corporation. Other product and 5 | company names mentioned herein may be trademarks or trade names of their 6 | respective owners. 7 | 8 | 9 | License 10 | 11 | Subject to the conditions below, you may use, copy, modify and/or merge copies 12 | of this software and associated content and documentation files (the ”Software”) 13 | to test, develop, publish, distribute, sub-license and/or sell new software 14 | derived from or incorporating the Software, solely in connection with Microsoft 15 | Mobile devices (however branded). Some of the documentation, content and/or 16 | software may be licensed under open source software or other licenses. To the 17 | extent such documentation, content and/or software are included, those licenses 18 | and/or other terms and conditions shall apply in addition and/or instead of this 19 | notice. The exact terms of the licenses, disclaimers, acknowledgements and 20 | notices are reproduced in the materials provided, or in other obvious locations. 21 | No other license to any other intellectual property rights is granted herein. 22 | 23 | This file, unmodified, shall be included with all copies or substantial portions 24 | of the Software that are distributed in source code form. 25 | 26 | The Software cannot constitute the primary value of any new software derived 27 | from or incorporating the Software. 28 | 29 | Any person dealing with the Software shall not misrepresent the source of the 30 | Software. 31 | 32 | 33 | Disclaimer 34 | 35 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 36 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 37 | FOR A PARTICULAR PURPOSE, QUALITY AND NONINFRINGEMENT. IN NO EVENT SHALL THE 38 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES (INCLUDING, 39 | WITHOUT LIMITATION, DIRECT, SPECIAL, INDIRECT, PUNITIVE, CONSEQUENTIAL, 40 | EXEMPLARY AND/ OR INCIDENTAL DAMAGES) OR OTHER LIABILITY, WHETHER IN AN ACTION 41 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 42 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 43 | 44 | Microsoft Mobile Oy retains the right to make changes to this document at any 45 | time, without notice. 46 | -------------------------------------------------------------------------------- /NfcNDefTagReader_Release_AnyCPU_v1_0.xap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/nfc-ndef-tag-reader/4be4355acf4a87fc4bfc6471581940ade74940d4/NfcNDefTagReader_Release_AnyCPU_v1_0.xap -------------------------------------------------------------------------------- /NfcNdefTagReader.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Express 2012 for Windows Phone 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NfcNdefTagReader", "NfcNDefTagReader\NfcNdefTagReader.csproj", "{2CC14932-8F7A-426F-8997-767E860B1410}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Debug|ARM = Debug|ARM 10 | Debug|x86 = Debug|x86 11 | Release|Any CPU = Release|Any CPU 12 | Release|ARM = Release|ARM 13 | Release|x86 = Release|x86 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {2CC14932-8F7A-426F-8997-767E860B1410}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {2CC14932-8F7A-426F-8997-767E860B1410}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {2CC14932-8F7A-426F-8997-767E860B1410}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 19 | {2CC14932-8F7A-426F-8997-767E860B1410}.Debug|ARM.ActiveCfg = Debug|ARM 20 | {2CC14932-8F7A-426F-8997-767E860B1410}.Debug|ARM.Build.0 = Debug|ARM 21 | {2CC14932-8F7A-426F-8997-767E860B1410}.Debug|ARM.Deploy.0 = Debug|ARM 22 | {2CC14932-8F7A-426F-8997-767E860B1410}.Debug|x86.ActiveCfg = Debug|x86 23 | {2CC14932-8F7A-426F-8997-767E860B1410}.Debug|x86.Build.0 = Debug|x86 24 | {2CC14932-8F7A-426F-8997-767E860B1410}.Debug|x86.Deploy.0 = Debug|x86 25 | {2CC14932-8F7A-426F-8997-767E860B1410}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {2CC14932-8F7A-426F-8997-767E860B1410}.Release|Any CPU.Build.0 = Release|Any CPU 27 | {2CC14932-8F7A-426F-8997-767E860B1410}.Release|Any CPU.Deploy.0 = Release|Any CPU 28 | {2CC14932-8F7A-426F-8997-767E860B1410}.Release|ARM.ActiveCfg = Release|ARM 29 | {2CC14932-8F7A-426F-8997-767E860B1410}.Release|ARM.Build.0 = Release|ARM 30 | {2CC14932-8F7A-426F-8997-767E860B1410}.Release|ARM.Deploy.0 = Release|ARM 31 | {2CC14932-8F7A-426F-8997-767E860B1410}.Release|x86.ActiveCfg = Release|x86 32 | {2CC14932-8F7A-426F-8997-767E860B1410}.Release|x86.Build.0 = Release|x86 33 | {2CC14932-8F7A-426F-8997-767E860B1410}.Release|x86.Deploy.0 = Release|x86 34 | EndGlobalSection 35 | GlobalSection(SolutionProperties) = preSolution 36 | HideSolutionNode = FALSE 37 | EndGlobalSection 38 | EndGlobal 39 | -------------------------------------------------------------------------------- /NfcNdefTagReader/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /NfcNdefTagReader/App.xaml.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012-2014 Microsoft Mobile. 3 | */ 4 | 5 | using System; 6 | using System.Diagnostics; 7 | using System.Resources; 8 | using System.Windows; 9 | using System.Windows.Markup; 10 | using System.Windows.Navigation; 11 | using Microsoft.Phone.Controls; 12 | using Microsoft.Phone.Shell; 13 | using NfcNdefTagReader.Resources; 14 | 15 | namespace NfcNdefTagReader 16 | { 17 | public partial class App : Application 18 | { 19 | /// 20 | /// Provides easy access to the root frame of the Phone Application. 21 | /// 22 | /// The root frame of the Phone Application. 23 | public static PhoneApplicationFrame RootFrame { get; private set; } 24 | 25 | /// 26 | /// Constructor for the Application object. 27 | /// 28 | public App() 29 | { 30 | // Global handler for uncaught exceptions. 31 | UnhandledException += Application_UnhandledException; 32 | 33 | // Standard XAML initialization 34 | InitializeComponent(); 35 | 36 | // Phone-specific initialization 37 | InitializePhoneApplication(); 38 | 39 | // Language display initialization 40 | InitializeLanguage(); 41 | 42 | // Show graphics profiling information while debugging. 43 | if (Debugger.IsAttached) 44 | { 45 | // Display the current frame rate counters. 46 | Application.Current.Host.Settings.EnableFrameRateCounter = true; 47 | 48 | // Show the areas of the app that are being redrawn in each frame. 49 | //Application.Current.Host.Settings.EnableRedrawRegions = true; 50 | 51 | // Enable non-production analysis visualization mode, 52 | // which shows areas of a page that are handed off to GPU with a colored overlay. 53 | //Application.Current.Host.Settings.EnableCacheVisualization = true; 54 | 55 | // Prevent the screen from turning off while under the debugger by disabling 56 | // the application's idle detection. 57 | // Caution:- Use this under debug mode only. Application that disables user idle detection will continue to run 58 | // and consume battery power when the user is not using the phone. 59 | PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled; 60 | } 61 | 62 | } 63 | 64 | // Code to execute when the application is launching (eg, from Start) 65 | // This code will not execute when the application is reactivated 66 | private void Application_Launching(object sender, LaunchingEventArgs e) 67 | { 68 | } 69 | 70 | // Code to execute when the application is activated (brought to foreground) 71 | // This code will not execute when the application is first launched 72 | private void Application_Activated(object sender, ActivatedEventArgs e) 73 | { 74 | } 75 | 76 | // Code to execute when the application is deactivated (sent to background) 77 | // This code will not execute when the application is closing 78 | private void Application_Deactivated(object sender, DeactivatedEventArgs e) 79 | { 80 | } 81 | 82 | // Code to execute when the application is closing (eg, user hit Back) 83 | // This code will not execute when the application is deactivated 84 | private void Application_Closing(object sender, ClosingEventArgs e) 85 | { 86 | } 87 | 88 | // Code to execute if a navigation fails 89 | private void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e) 90 | { 91 | if (Debugger.IsAttached) 92 | { 93 | // A navigation has failed; break into the debugger 94 | Debugger.Break(); 95 | } 96 | } 97 | 98 | // Code to execute on Unhandled Exceptions 99 | private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) 100 | { 101 | if (Debugger.IsAttached) 102 | { 103 | // An unhandled exception has occurred; break into the debugger 104 | Debugger.Break(); 105 | } 106 | } 107 | 108 | #region Phone application initialization 109 | 110 | // Avoid double-initialization 111 | private bool phoneApplicationInitialized = false; 112 | 113 | // Do not add any additional code to this method 114 | private void InitializePhoneApplication() 115 | { 116 | if (phoneApplicationInitialized) 117 | return; 118 | 119 | // Create the frame but don't set it as RootVisual yet; this allows the splash 120 | // screen to remain active until the application is ready to render. 121 | RootFrame = new PhoneApplicationFrame(); 122 | RootFrame.Navigated += CompleteInitializePhoneApplication; 123 | 124 | // Handle navigation failures 125 | RootFrame.NavigationFailed += RootFrame_NavigationFailed; 126 | 127 | // Handle reset requests for clearing the backstack 128 | RootFrame.Navigated += CheckForResetNavigation; 129 | 130 | // Ensure we don't initialize again 131 | phoneApplicationInitialized = true; 132 | } 133 | 134 | // Do not add any additional code to this method 135 | private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e) 136 | { 137 | // Set the root visual to allow the application to render 138 | if (RootVisual != RootFrame) 139 | RootVisual = RootFrame; 140 | 141 | // Remove this handler since it is no longer needed 142 | RootFrame.Navigated -= CompleteInitializePhoneApplication; 143 | } 144 | 145 | private void CheckForResetNavigation(object sender, NavigationEventArgs e) 146 | { 147 | // If the app has received a 'reset' navigation, then we need to check 148 | // on the next navigation to see if the page stack should be reset 149 | if (e.NavigationMode == NavigationMode.Reset) 150 | RootFrame.Navigated += ClearBackStackAfterReset; 151 | } 152 | 153 | private void ClearBackStackAfterReset(object sender, NavigationEventArgs e) 154 | { 155 | // Unregister the event so it doesn't get called again 156 | RootFrame.Navigated -= ClearBackStackAfterReset; 157 | 158 | // Only clear the stack for 'new' (forward) and 'refresh' navigations 159 | if (e.NavigationMode != NavigationMode.New && e.NavigationMode != NavigationMode.Refresh) 160 | return; 161 | 162 | // For UI consistency, clear the entire page stack 163 | while (RootFrame.RemoveBackEntry() != null) 164 | { 165 | ; // do nothing 166 | } 167 | } 168 | 169 | #endregion 170 | 171 | // Initialize the app's font and flow direction as defined in its localized resource strings. 172 | // 173 | // To ensure that the font of your application is aligned with its supported languages and that the 174 | // FlowDirection for each of those languages follows its traditional direction, ResourceLanguage 175 | // and ResourceFlowDirection should be initialized in each resx file to match these values with that 176 | // file's culture. For example: 177 | // 178 | // AppResources.es-ES.resx 179 | // ResourceLanguage's value should be "es-ES" 180 | // ResourceFlowDirection's value should be "LeftToRight" 181 | // 182 | // AppResources.ar-SA.resx 183 | // ResourceLanguage's value should be "ar-SA" 184 | // ResourceFlowDirection's value should be "RightToLeft" 185 | // 186 | // For more info on localizing Windows Phone apps see http://go.microsoft.com/fwlink/?LinkId=262072. 187 | // 188 | private void InitializeLanguage() 189 | { 190 | try 191 | { 192 | // Set the font to match the display language defined by the 193 | // ResourceLanguage resource string for each supported language. 194 | // 195 | // Fall back to the font of the neutral language if the Display 196 | // language of the phone is not supported. 197 | // 198 | // If a compiler error is hit then ResourceLanguage is missing from 199 | // the resource file. 200 | RootFrame.Language = XmlLanguage.GetLanguage(AppResources.ResourceLanguage); 201 | 202 | // Set the FlowDirection of all elements under the root frame based 203 | // on the ResourceFlowDirection resource string for each 204 | // supported language. 205 | // 206 | // If a compiler error is hit then ResourceFlowDirection is missing from 207 | // the resource file. 208 | FlowDirection flow = (FlowDirection)Enum.Parse(typeof(FlowDirection), AppResources.ResourceFlowDirection); 209 | RootFrame.FlowDirection = flow; 210 | } 211 | catch 212 | { 213 | // If an exception is caught here it is most likely due to either 214 | // ResourceLangauge not being correctly set to a supported language 215 | // code or ResourceFlowDirection is set to a value other than LeftToRight 216 | // or RightToLeft. 217 | 218 | if (Debugger.IsAttached) 219 | { 220 | Debugger.Break(); 221 | } 222 | 223 | throw; 224 | } 225 | } 226 | } 227 | } -------------------------------------------------------------------------------- /NfcNdefTagReader/Assets/Images/NFC-device-smaller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/nfc-ndef-tag-reader/4be4355acf4a87fc4bfc6471581940ade74940d4/NfcNdefTagReader/Assets/Images/NFC-device-smaller.png -------------------------------------------------------------------------------- /NfcNdefTagReader/Assets/Images/NFC-device-smaller_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/nfc-ndef-tag-reader/4be4355acf4a87fc4bfc6471581940ade74940d4/NfcNdefTagReader/Assets/Images/NFC-device-smaller_2.png -------------------------------------------------------------------------------- /NfcNdefTagReader/Assets/Images/NFC-device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/nfc-ndef-tag-reader/4be4355acf4a87fc4bfc6471581940ade74940d4/NfcNdefTagReader/Assets/Images/NFC-device.png -------------------------------------------------------------------------------- /NfcNdefTagReader/Assets/Images/NFC-device_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/nfc-ndef-tag-reader/4be4355acf4a87fc4bfc6471581940ade74940d4/NfcNdefTagReader/Assets/Images/NFC-device_2.png -------------------------------------------------------------------------------- /NfcNdefTagReader/Assets/NFC-device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/nfc-ndef-tag-reader/4be4355acf4a87fc4bfc6471581940ade74940d4/NfcNdefTagReader/Assets/NFC-device.png -------------------------------------------------------------------------------- /NfcNdefTagReader/Assets/Tiles/NfcNdefTagReader-large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/nfc-ndef-tag-reader/4be4355acf4a87fc4bfc6471581940ade74940d4/NfcNdefTagReader/Assets/Tiles/NfcNdefTagReader-large.png -------------------------------------------------------------------------------- /NfcNdefTagReader/Assets/Tiles/NfcNdefTagReader-medium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/nfc-ndef-tag-reader/4be4355acf4a87fc4bfc6471581940ade74940d4/NfcNdefTagReader/Assets/Tiles/NfcNdefTagReader-medium.png -------------------------------------------------------------------------------- /NfcNdefTagReader/Assets/Tiles/NfcNdefTagReader-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/nfc-ndef-tag-reader/4be4355acf4a87fc4bfc6471581940ade74940d4/NfcNdefTagReader/Assets/Tiles/NfcNdefTagReader-small.png -------------------------------------------------------------------------------- /NfcNdefTagReader/LocalizedStrings.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012-2014 Microsoft Mobile. 3 | */ 4 | 5 | using NfcNdefTagReader.Resources; 6 | 7 | namespace NfcNdefTagReader 8 | { 9 | /// 10 | /// Provides access to string resources. 11 | /// 12 | public class LocalizedStrings 13 | { 14 | private static AppResources _localizedResources = new AppResources(); 15 | 16 | public AppResources LocalizedResources { get { return _localizedResources; } } 17 | } 18 | } -------------------------------------------------------------------------------- /NfcNdefTagReader/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  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 | -------------------------------------------------------------------------------- /NfcNdefTagReader/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012-2014 Microsoft Mobile. 3 | */ 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using Microsoft.Phone.Controls; 9 | using Windows.Networking.Proximity; 10 | using Windows.Storage.Streams; 11 | 12 | namespace NfcNdefTagReader 13 | { 14 | /// 15 | /// The application logic implementation of the main page. 16 | /// 17 | public partial class MainPage : PhoneApplicationPage 18 | { 19 | // The list of records 20 | private List recordList; 21 | 22 | // The subscription ID from ProximityDevice 23 | private long subscriptionId; 24 | 25 | // ProximityDevice instance 26 | private ProximityDevice device; 27 | 28 | // The log content which will be filled with the details of each 29 | // detected NFC tag 30 | private string logText; 31 | 32 | /// 33 | /// Constructor. 34 | /// 35 | public MainPage() 36 | { 37 | InitializeComponent(); 38 | recordList = new List(); 39 | device = ProximityDevice.GetDefault(); 40 | device.DeviceArrived += DeviceArrived; 41 | device.DeviceDeparted += DeviceDeparted; 42 | SubscribeForMessage(); 43 | } 44 | 45 | /// 46 | /// Gets called when a detected NFC device is disconnected after arrival. 47 | /// 48 | /// ProximityDevice instance 49 | private void DeviceDeparted(ProximityDevice sender) 50 | { 51 | Dispatcher.BeginInvoke(() => 52 | { 53 | logText = logText + "\nLost at " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second + "\n"; 54 | AppText.Text = logText + AppText.Text; 55 | }); 56 | } 57 | 58 | /// 59 | /// Gets called when a NFC device is detected. 60 | /// 61 | /// ProximityDevice instance 62 | private void DeviceArrived(ProximityDevice sender) 63 | { 64 | Dispatcher.BeginInvoke(() => 65 | { 66 | logText = "\nDetected at " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second; 67 | }); 68 | } 69 | 70 | /// 71 | /// Gets called when a message is received. Updates the UI by adding 72 | /// the details into the log and scrolling the log if necessary. 73 | /// Note that subscription for messages needs to be redone. 74 | /// 75 | /// ProximityDevice instance 76 | /// A message to be handled. 77 | private void MessageReceived(ProximityDevice sender, ProximityMessage message) 78 | { 79 | Dispatcher.BeginInvoke(() => 80 | { 81 | if (device != null) 82 | { 83 | device.StopSubscribingForMessage(subscriptionId); 84 | } 85 | 86 | logText = logText + ParseNDEF(message); 87 | ScrollViewer.UpdateLayout(); 88 | ScrollViewer.ScrollToVerticalOffset(0); 89 | SubscribeForMessage(); 90 | }); 91 | } 92 | 93 | /// 94 | /// Parses the details from the given message. The output is a string 95 | /// that can be appended into the log. 96 | /// 97 | /// The message to parse. 98 | /// The parsed details as a string. 99 | private string ParseNDEF(ProximityMessage message) { 100 | var output = ""; 101 | 102 | using (var buf = DataReader.FromBuffer(message.Data)) { 103 | NdefRecordUtility.ReadNdefRecord(buf,recordList); 104 | 105 | for (int i = 0, recordNumber = 0, spRecordNumber = 0; i < recordList.Count; i++) 106 | { 107 | NdefRecord record = recordList.ElementAt(i); 108 | 109 | if (!record.IsSpRecord ) 110 | { 111 | if (System.Text.Encoding.UTF8.GetString(record.Type, 0, record.TypeLength) == "Sp") 112 | { 113 | output = output + "\n --End of Record No." + recordNumber; spRecordNumber = 0; 114 | continue; 115 | } 116 | else 117 | { 118 | recordNumber++; 119 | output = output + "\n --Record No." + recordNumber; 120 | } 121 | } 122 | else 123 | { 124 | if (spRecordNumber == 0) 125 | { 126 | recordNumber++; 127 | output = output + "\n --Record No." + recordNumber; 128 | } 129 | 130 | spRecordNumber++; 131 | output = output + "\n Sp sub-record No." + spRecordNumber; 132 | } 133 | 134 | output = output + "\n MB:" + ((record.Mb) ? "1;" : "0;"); 135 | output = output + " ME:" + ((record.Me) ? "1;" : "0;"); 136 | output = output + " CF:" + ((record.Cf) ? "1;" : "0;"); 137 | output = output + " SR:" + ((record.Sr) ? "1;" : "0;"); 138 | output = output + " IL:" + ((record.Il) ? "1;" : "0;"); 139 | 140 | string typeName = NdefRecordUtility.GetTypeNameFormat(record); 141 | 142 | if (record.TypeLength > 0) 143 | { 144 | output = output + "\n Type: " + typeName + ":" 145 | + System.Text.Encoding.UTF8.GetString(record.Type, 0, record.TypeLength); 146 | } 147 | 148 | if ((record.Il) && (record.IdLength > 0)) 149 | { 150 | output = output + "\n Id:" 151 | + System.Text.Encoding.UTF8.GetString(record.Id, 0, record.IdLength); 152 | } 153 | 154 | if ((record.PayloadLength > 0) && (record.Payload != null)) 155 | { 156 | if ((record.Tnf == 0x01) 157 | && (System.Text.Encoding.UTF8.GetString(record.Type, 0, record.TypeLength) == "U")) 158 | { 159 | NdefUriRtd uri = new NdefUriRtd(); 160 | NdefRecordUtility.ReadUriRtd(record, uri); 161 | output = output + "\n Uri: " + uri.GetFullUri(); 162 | } 163 | else if ((record.Tnf == 0x01) 164 | && (System.Text.Encoding.UTF8.GetString(record.Type, 0, record.TypeLength) == "T")) 165 | { 166 | NdefTextRtd text = new NdefTextRtd(); 167 | NdefRecordUtility.ReadTextRtd(record, text); 168 | output = output + "\n Language: " + text.Language; 169 | output = output + "\n Encoding: " + text.Encoding; 170 | output = output + "\n Text: " + text.Text; 171 | } 172 | else 173 | { 174 | if (record.Tnf==0x01) 175 | { 176 | output = output + "\n Payload:" 177 | + System.Text.Encoding.UTF8.GetString(record.Payload, 0, record.Payload.Length); 178 | } 179 | } 180 | } 181 | 182 | if (!record.IsSpRecord) 183 | { 184 | output = output + "\n --End of Record No." + recordNumber; 185 | } 186 | } 187 | } 188 | 189 | return output; 190 | } 191 | 192 | /// 193 | /// Subscribes for NDEF messages. This ensures that we get notified 194 | /// about the NFC events. 195 | /// 196 | private void SubscribeForMessage() 197 | { 198 | if (device != null) 199 | { 200 | recordList.Clear(); 201 | subscriptionId = device.SubscribeForMessage("NDEF", MessageReceived); 202 | } 203 | } 204 | } 205 | } 206 | -------------------------------------------------------------------------------- /NfcNdefTagReader/NdefRecord.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012-2014 Microsoft Mobile. 3 | */ 4 | 5 | using System; 6 | 7 | namespace NfcNdefTagReader 8 | { 9 | /// 10 | /// Container class for NDEF record information. The class property names 11 | /// are defined based on the NDEF specification: 12 | /// - Mb: Message begin 13 | /// - Me: Message end 14 | /// - Cf: Chunk flag 15 | /// - Sr: Short record 16 | /// - Il: ID length of the field present 17 | /// - Tnf: Type name format 18 | /// 19 | /// For further information, see http://www.nfc-forum.org/spec 20 | /// 21 | public class NdefRecord 22 | { 23 | public bool Mb { get; set; } 24 | public bool Me { get; set; } 25 | public bool Cf { get; set; } 26 | public bool Sr { get; set; } 27 | public bool Il { get; set; } 28 | public byte Tnf { get; set; } 29 | 30 | public UInt16 TypeLength { get; set; } 31 | public UInt16 IdLength { get; set; } 32 | public UInt32 PayloadLength { get; set; } 33 | public byte[] Type { get; set; } 34 | public byte[] Id { get; set; } 35 | public byte[] Payload { get; set; } 36 | 37 | // Is Smart Poster record 38 | public bool IsSpRecord { get; set; } 39 | 40 | /// 41 | /// Constructor 42 | /// 43 | public NdefRecord() 44 | { 45 | Type = null; 46 | Id = null; 47 | Payload = null; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /NfcNdefTagReader/NdefRecordTypeDefinitions.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012-2014 Microsoft Mobile. 3 | */ 4 | 5 | namespace NfcNdefTagReader 6 | { 7 | /// 8 | /// NDEF URI Record Type Definitions (RTD) 9 | /// 10 | class NdefUriRtd 11 | { 12 | // Identifier for Uri. e.g. http:// 13 | public string Identifier { get; set; } 14 | 15 | // Uri without the identifier, e.g. nokia.com 16 | public string Uri { get; set; } 17 | 18 | // Full Uri to be displayed (with identifier) 19 | public string GetFullUri() { return (Identifier + Uri); } 20 | } 21 | 22 | /// 23 | /// NDEF Text Record Type Definitions (RTD) 24 | /// 25 | class NdefTextRtd 26 | { 27 | // Language code in ISO/IANA, e.g. en-US 28 | public string Language { get; set; } 29 | 30 | // Encoding, UTF-8 or UTF16 31 | public string Encoding { get; set; } 32 | 33 | // Text to be displayed after decoding 34 | public string Text { get; set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /NfcNdefTagReader/NdefRecordUtility.cs: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2012-2014 Microsoft Mobile. 3 | */ 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | using Windows.Storage.Streams; 8 | 9 | namespace NfcNdefTagReader 10 | { 11 | /// 12 | /// This class provides the utility methods for handling NDEF record data. 13 | /// 14 | static class NdefRecordUtility 15 | { 16 | /// 17 | /// Resolves the type name format of the given record. 18 | /// 19 | /// NDEF record 20 | /// The type name format matching the given record. 21 | static public string GetTypeNameFormat(NdefRecord record) 22 | { 23 | var typeName = ""; 24 | 25 | switch (record.Tnf) 26 | { 27 | case 0x00: 28 | typeName = "empty"; 29 | break; 30 | case 0x01: 31 | typeName = "wkt"; 32 | break; 33 | case 0x02: 34 | typeName = "mimetype"; 35 | break; 36 | case 0x03: 37 | typeName = "absUri"; 38 | break; 39 | case 0x04: 40 | typeName = "ext"; 41 | break; 42 | case 0x05: 43 | typeName = "unknown"; 44 | break; 45 | case 0x06: 46 | typeName = "unchanged"; 47 | break; 48 | case 0x07: 49 | typeName = "reserved"; 50 | break; 51 | default: 52 | typeName = "error"; 53 | break; 54 | } 55 | 56 | return typeName; 57 | } 58 | 59 | /// 60 | /// Extracts the data from the given record and places it into the 61 | /// given URI RTD. 62 | /// 63 | /// The record containing the URI data. 64 | /// Where the data is placed. 65 | static public void ReadUriRtd(NdefRecord record, NdefUriRtd uri) 66 | { 67 | byte[] buf = record.Payload; 68 | uri.Identifier = GetUriIdentifier(buf[0]); 69 | uri.Uri= System.Text.Encoding.UTF8.GetString(buf, 1, buf.Length-1); 70 | } 71 | 72 | /// 73 | /// Extracts the data from the given record and places it into the 74 | /// given text RTD. 75 | /// 76 | /// The record containing the data. 77 | /// Where the data is placed. 78 | static public void ReadTextRtd(NdefRecord record, NdefTextRtd text) 79 | { 80 | byte[] buf = record.Payload; 81 | 82 | if (IsBitSet(buf[0], 6)) 83 | { 84 | return; 85 | } 86 | 87 | var langLen = (byte)(buf[0] & 0x3f); 88 | var langBuf = new byte[langLen]; 89 | System.Buffer.BlockCopy(buf, 1, langBuf, 0, langLen); 90 | text.Language=System.Text.Encoding.UTF8.GetString(langBuf, 0, langBuf.Length); 91 | var textLen = buf.Length - 1 - langLen; 92 | 93 | if (textLen <= 0) 94 | { 95 | return; 96 | } 97 | 98 | var textBuf = new byte[textLen]; 99 | System.Buffer.BlockCopy(buf, 1 + langLen, textBuf, 0, textLen); 100 | 101 | if (IsBitSet(buf[0], 7)) 102 | { 103 | text.Encoding = "UTF-16"; 104 | text.Text = System.Text.Encoding.Unicode.GetString(textBuf, 0, textBuf.Length); 105 | } 106 | else 107 | { 108 | text.Encoding = "UTF-8"; 109 | text.Text = System.Text.Encoding.UTF8.GetString(textBuf, 0, textBuf.Length); 110 | } 111 | } 112 | 113 | /// 114 | /// ReadNdefRecord reads a list of NdefRecord from DataReader 115 | /// 116 | /// data buffer contains NdefRecord (s) 117 | /// a list of NdefRecord as output 118 | static public void ReadNdefRecord(DataReader buf, List list) 119 | { 120 | ReadNdefRecord(buf, list, false); 121 | } 122 | 123 | /// 124 | /// Creates NDEF records based on the data in the given buffer. 125 | /// 126 | /// The data buffer as input. 127 | /// The list of new NDEF records as output. 128 | /// Defines whether the first record is smart poster or not. 129 | static private void ReadNdefRecord(DataReader buf, List list, bool isFirstRecordSp) 130 | { 131 | var record = new NdefRecord(); 132 | byte header = buf.ReadByte(); 133 | record.Mb = IsBitSet(header, 7); 134 | record.Me = IsBitSet(header, 6); 135 | record.Cf = IsBitSet(header, 5); 136 | record.Sr = IsBitSet(header, 4); 137 | record.Il = IsBitSet(header, 3); 138 | record.Tnf = (byte)(header & 0x07); 139 | record.TypeLength = buf.ReadByte(); 140 | record.IsSpRecord = isFirstRecordSp; 141 | 142 | if (record.Il) 143 | { 144 | record.IdLength = buf.ReadByte(); 145 | } 146 | else 147 | { 148 | record.IdLength = 0; 149 | } 150 | 151 | if (record.Sr) 152 | { 153 | record.PayloadLength = buf.ReadByte(); 154 | } 155 | else 156 | { 157 | var lengthBuf = new byte[4]; 158 | buf.ReadBytes(lengthBuf); 159 | record.PayloadLength = BitConverter.ToUInt32(lengthBuf, 0); 160 | } 161 | 162 | if (record.TypeLength > 0) 163 | { 164 | record.Type = new byte[record.TypeLength]; 165 | buf.ReadBytes(record.Type); 166 | } 167 | 168 | if ((record.Il) && (record.IdLength > 0)) 169 | { 170 | record.Id = new byte[record.IdLength]; 171 | buf.ReadBytes(record.Id); 172 | } 173 | 174 | if (record.PayloadLength > 0) 175 | { 176 | if ((record.Tnf == 0x01) 177 | && (System.Text.Encoding.UTF8.GetString(record.Type, 0, record.TypeLength) == "Sp")) 178 | { 179 | ReadNdefRecord(buf, list, true); 180 | record.Payload = null; 181 | } 182 | else 183 | { 184 | record.Payload = new byte[record.PayloadLength]; 185 | buf.ReadBytes(record.Payload); 186 | } 187 | } 188 | 189 | list.Add(record); 190 | 191 | if (!record.Me) 192 | { 193 | ReadNdefRecord(buf, list, isFirstRecordSp); 194 | } 195 | } 196 | 197 | /// 198 | /// Checks if a bit is set in a byte or not. 199 | /// 200 | /// The byte as input. 201 | /// The bit position as input. 202 | /// True if the bit is set, false otherwise. 203 | static private bool IsBitSet(byte b, int pos) 204 | { 205 | return (b & (1 << pos)) != 0; 206 | } 207 | 208 | /// 209 | /// Resolves the URI identifier based on the given byte. 210 | /// 211 | /// The byte as input. 212 | /// The identifier. 213 | static private string GetUriIdentifier(byte abbrByte) 214 | { 215 | var identifier = ""; 216 | 217 | switch (abbrByte) 218 | { 219 | case 0x00: identifier = ""; 220 | break; 221 | case 0x01: identifier = "http://www."; 222 | break; 223 | case 0x02: identifier = "https://www."; 224 | break; 225 | case 0x03: identifier = "http://"; 226 | break; 227 | case 0x04: identifier = "https://"; 228 | break; 229 | case 0x05: identifier = "tel:"; 230 | break; 231 | case 0x06: identifier = "mailto:"; 232 | break; 233 | case 0x07: identifier = "ftp://anonymous:anonymous@"; 234 | break; 235 | case 0x08: identifier = "ftp://ftp."; 236 | break; 237 | case 0x09: identifier = "ftps://"; 238 | break; 239 | case 0x0A: identifier = "sftp://"; 240 | break; 241 | case 0x0B: identifier = "smb://"; 242 | break; 243 | case 0x0c: identifier = "nfs://"; 244 | break; 245 | case 0x0d: identifier = "ftp://"; 246 | break; 247 | case 0x0e: identifier = "dav://"; 248 | break; 249 | case 0x0f: identifier = "news:"; 250 | break; 251 | case 0x10: identifier = "telnet://"; 252 | break; 253 | case 0x11: identifier = "imap:"; 254 | break; 255 | case 0x12: identifier = "rtsp://"; 256 | break; 257 | case 0x13: identifier = "urn:"; 258 | break; 259 | case 0x14: identifier = "pop:"; 260 | break; 261 | case 0x15: identifier = "sip:"; 262 | break; 263 | case 0x16: identifier = "sips:"; 264 | break; 265 | case 0x17: identifier = "tftp:"; 266 | break; 267 | case 0x18: identifier = "btspp://"; 268 | break; 269 | case 0x19: identifier = "btl2cap://"; 270 | break; 271 | case 0x1a: identifier = "btgoep://"; 272 | break; 273 | case 0x1b: identifier = "tepobex://"; 274 | break; 275 | case 0x1c: identifier = "irdaobex://"; 276 | break; 277 | case 0x1d: identifier = "file://"; 278 | break; 279 | case 0x1e: identifier = "urn:epc:id:"; 280 | break; 281 | case 0x1f: identifier = "urn:epc:tag:"; 282 | break; 283 | case 0x20: identifier = "urn:epc:pat:"; 284 | break; 285 | case 0x21: identifier = "urn:epc:raw:"; 286 | break; 287 | case 0x22: identifier = "urn:epc:"; 288 | break; 289 | case 0x23: identifier = "urn:nfc:"; 290 | break; 291 | default: identifier = "RFU"; 292 | break; 293 | } 294 | return identifier; 295 | } 296 | } 297 | } 298 | -------------------------------------------------------------------------------- /NfcNdefTagReader/NfcNdefTagReader.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 10.0.20506 7 | 2.0 8 | {2CC14932-8F7A-426F-8997-767E860B1410} 9 | {C089C8C0-30E0-4E22-80C0-CE093F111A43};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} 10 | Library 11 | Properties 12 | NfcNDefTagReader 13 | NfcNDefTagReader 14 | WindowsPhone 15 | v8.0 16 | $(TargetFrameworkVersion) 17 | true 18 | 19 | 20 | true 21 | true 22 | NfcNDefTagReader_$(Configuration)_$(Platform).xap 23 | Properties\AppManifest.xml 24 | NfcNdefTagReader.App 25 | true 26 | 11.0 27 | true 28 | 29 | 30 | true 31 | full 32 | false 33 | Bin\Debug 34 | DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE 35 | true 36 | true 37 | prompt 38 | 4 39 | 40 | 41 | pdbonly 42 | true 43 | Bin\Release 44 | TRACE;SILVERLIGHT;WINDOWS_PHONE 45 | true 46 | true 47 | prompt 48 | 4 49 | 50 | 51 | true 52 | full 53 | false 54 | Bin\x86\Debug 55 | DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE 56 | true 57 | true 58 | prompt 59 | 4 60 | 61 | 62 | pdbonly 63 | true 64 | Bin\x86\Release 65 | TRACE;SILVERLIGHT;WINDOWS_PHONE 66 | true 67 | true 68 | prompt 69 | 4 70 | 71 | 72 | true 73 | full 74 | false 75 | Bin\ARM\Debug 76 | DEBUG;TRACE;SILVERLIGHT;WINDOWS_PHONE 77 | true 78 | true 79 | prompt 80 | 4 81 | 82 | 83 | pdbonly 84 | true 85 | Bin\ARM\Release 86 | TRACE;SILVERLIGHT;WINDOWS_PHONE 87 | true 88 | true 89 | prompt 90 | 4 91 | 92 | 93 | 94 | App.xaml 95 | 96 | 97 | 98 | MainPage.xaml 99 | 100 | 101 | 102 | 103 | 104 | 105 | True 106 | True 107 | AppResources.resx 108 | 109 | 110 | 111 | 112 | Designer 113 | MSBuild:Compile 114 | 115 | 116 | Designer 117 | MSBuild:Compile 118 | 119 | 120 | 121 | 122 | 123 | Designer 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | PublicResXFileCodeGenerator 135 | AppResources.Designer.cs 136 | 137 | 138 | 139 | 140 | 147 | 148 | -------------------------------------------------------------------------------- /NfcNdefTagReader/NfcNdefTagReader.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 256 5 | 30F105C9-681E-420b-A277-7C086EAD8A4E 6 | 7 | 8 | 256 9 | 30F105C9-681E-420b-A277-7C086EAD8A4E 10 | 11 | 12 | 13 | 14 | 15 | False 16 | Managed 17 | Managed 18 | False 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /NfcNdefTagReader/Properties/AppManifest.xml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /NfcNdefTagReader/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using System.Resources; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("NfcNdefTagReader")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("Nokia")] 13 | [assembly: AssemblyProduct("NfcNdefTagReader")] 14 | [assembly: AssemblyCopyright("Copyright © 2012")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("ab6e8015-bb0e-40b1-a5ac-f69c757c14f5")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | // You can specify all the values or you can default the Revision and Build Numbers 34 | // by using the '*' as shown below: 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | [assembly: NeutralResourcesLanguageAttribute("en-US")] 38 | -------------------------------------------------------------------------------- /NfcNdefTagReader/Properties/WMAppManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Assets\Tiles\NfcNdefTagReader-small.png 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Assets\Tiles\NfcNdefTagReader-small.png 18 | 0 19 | Assets\Tiles\NfcNdefTagReader-medium.png 20 | NFC NDEF Tag Reader 21 | 22 | 23 | 24 | 25 | 26 | 27 | Assets\Tiles\NfcNdefTagReader-large.png 28 | 29 | 30 | 31 | 32 | 33 | 34 | True 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /NfcNdefTagReader/Resources/AppResources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.17626 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 NfcNdefTagReader.Resources 12 | { 13 | using System; 14 | 15 | 16 | /// 17 | /// A strongly-typed resource class, for looking up localized strings, etc. 18 | /// 19 | // This class was auto-generated by the StronglyTypedResourceBuilder 20 | // class via a tool like ResGen or Visual Studio. 21 | // To add or remove a member, edit your .ResX file then rerun ResGen 22 | // with the /str option, or rebuild your VS project. 23 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 24 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 25 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 26 | public class AppResources 27 | { 28 | 29 | private static global::System.Resources.ResourceManager resourceMan; 30 | 31 | private static global::System.Globalization.CultureInfo resourceCulture; 32 | 33 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 34 | internal AppResources() 35 | { 36 | } 37 | 38 | /// 39 | /// Returns the cached ResourceManager instance used by this class. 40 | /// 41 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 42 | public static global::System.Resources.ResourceManager ResourceManager 43 | { 44 | get 45 | { 46 | if (object.ReferenceEquals(resourceMan, null)) 47 | { 48 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NfcNdefTagReader.Resources.AppResources", typeof(AppResources).Assembly); 49 | resourceMan = temp; 50 | } 51 | return resourceMan; 52 | } 53 | } 54 | 55 | /// 56 | /// Overrides the current thread's CurrentUICulture property for all 57 | /// resource lookups using this strongly typed resource class. 58 | /// 59 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 60 | public static global::System.Globalization.CultureInfo Culture 61 | { 62 | get 63 | { 64 | return resourceCulture; 65 | } 66 | set 67 | { 68 | resourceCulture = value; 69 | } 70 | } 71 | 72 | /// 73 | /// Looks up a localized string similar to LeftToRight. 74 | /// 75 | public static string ResourceFlowDirection 76 | { 77 | get 78 | { 79 | return ResourceManager.GetString("ResourceFlowDirection", resourceCulture); 80 | } 81 | } 82 | 83 | /// 84 | /// Looks up a localized string similar to us-EN. 85 | /// 86 | public static string ResourceLanguage 87 | { 88 | get 89 | { 90 | return ResourceManager.GetString("ResourceLanguage", resourceCulture); 91 | } 92 | } 93 | 94 | /// 95 | /// Looks up a localized string similar to MY APPLICATION. 96 | /// 97 | public static string ApplicationTitle 98 | { 99 | get 100 | { 101 | return ResourceManager.GetString("ApplicationTitle", resourceCulture); 102 | } 103 | } 104 | 105 | /// 106 | /// Looks up a localized string similar to button. 107 | /// 108 | public static string AppBarButtonText 109 | { 110 | get 111 | { 112 | return ResourceManager.GetString("AppBarButtonText", resourceCulture); 113 | } 114 | } 115 | 116 | /// 117 | /// Looks up a localized string similar to menu item. 118 | /// 119 | public static string AppBarMenuItemText 120 | { 121 | get 122 | { 123 | return ResourceManager.GetString("AppBarMenuItemText", resourceCulture); 124 | } 125 | } 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /NfcNdefTagReader/Resources/AppResources.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 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | LeftToRight 122 | Controls the FlowDirection for all elements in the RootFrame. Set to the traditional direction of this resource file's language 123 | 124 | 125 | en-US 126 | Controls the Language and ensures that the font for all elements in the RootFrame aligns with the app's language. Set to the language code of this resource file's language. 127 | 128 | 129 | MY APPLICATION 130 | 131 | 132 | add 133 | 134 | 135 | Menu Item 136 | 137 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | NFC NDEF Tag Reader 2 | =================== 3 | 4 | A simple NFC tag reader application for Windows Phone 8. This example app 5 | demonstrates how to use the Proximity API to read NFC Data Exchange Format 6 | (NDEF) compliant tags. 7 | 8 | ![Screenshot](/doc/nfcndeftagreader-2.png?raw=true) 9 | 10 | This example application is hosted in GitHub: 11 | https://github.com/Microsoft/nfc-ndef-tag-reader 12 | 13 | For more information on implementation and porting, visit Lumia 14 | Developer's Library: 15 | http://developer.nokia.com/Resources/Library/Lumia/#!code-examples/nfc-ndef-tag-reader.html 16 | 17 | The project is compatible with Windows Phone 8. Developed with Microsoft Visual 18 | Studio Express 2012 for Windows Phone. 19 | 20 | 21 | 1. Building, installing, and running the application 22 | ------------------------------------------------------------------------------- 23 | 24 | You need to have Windows 8 and Windows Phone SDK 8.0 or later installed. 25 | 26 | Using the Windows Phone 8 SDK: 27 | 28 | 1. Open the SLN file: File > Open Project, select the file 29 | `NfcNdefTagReader.sln` 30 | 2. Select the target 'Device'. 31 | 3. Press F5 to build the project and run it on the device. 32 | 33 | Please see the official documentation for 34 | deploying and testing applications on Windows Phone devices: 35 | http://msdn.microsoft.com/en-us/library/gg588378%28v=vs.92%29.aspx 36 | 37 | 38 | 2. About implementation 39 | ------------------------------------------------------------------------------- 40 | 41 | Important files and classes: 42 | 43 | * `MainPage.cs`: Ties the UI and the application logic together. Contains the 44 | method for parsing the NDEF data. Shows the log containing the details of each 45 | tag read. 46 | * `NdefRecordUtility.cs`: Contains utility methods for handling NDEF tag data. 47 | * `NdefRecord.cs`: Container class for NDEF record data. 48 | * `NdefRecordTypeDefinitions.cs`: Contains the implementation for two Record 49 | Type Definitions (RTD) classes: `NdefTextRtd` and `NdefUriRtd`. Like the names 50 | of the classes indicate, the first is for text and the second for URI types. 51 | 52 | 53 | Required capabilities: 54 | 55 | * `ID_CAP_NETWORKING` 56 | * `ID_CAP_PROXIMITY` 57 | 58 | 59 | 3. License 60 | ------------------------------------------------------------------------------- 61 | 62 | See the license text file delivered with this project. The license file is also 63 | available online at 64 | https://github.com/Microsoft/nfc-ndef-tag-reader/blob/master/Licence.txt 65 | 66 | 67 | 4. Version history 68 | ------------------------------------------------------------------------------- 69 | 70 | * Version 1.0: The initial release. 71 | -------------------------------------------------------------------------------- /doc/app_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/nfc-ndef-tag-reader/4be4355acf4a87fc4bfc6471581940ade74940d4/doc/app_icon.png -------------------------------------------------------------------------------- /doc/nfcndeftagreader-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/nfc-ndef-tag-reader/4be4355acf4a87fc4bfc6471581940ade74940d4/doc/nfcndeftagreader-1.png -------------------------------------------------------------------------------- /doc/nfcndeftagreader-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/nfc-ndef-tag-reader/4be4355acf4a87fc4bfc6471581940ade74940d4/doc/nfcndeftagreader-2.png -------------------------------------------------------------------------------- /doc/nfcndeftagreader-uml-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/microsoft/nfc-ndef-tag-reader/4be4355acf4a87fc4bfc6471581940ade74940d4/doc/nfcndeftagreader-uml-diagram.png --------------------------------------------------------------------------------