init
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
src/ndefpclib/obj/
|
||||
@@ -1,44 +0,0 @@
|
||||
<phone:PhoneApplicationPage
|
||||
x:Class="CampusAppWP8.Pages.Dev.NFC"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
|
||||
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
FontFamily="{StaticResource PhoneFontFamilyNormal}"
|
||||
FontSize="{StaticResource PhoneFontSizeNormal}"
|
||||
Foreground="{StaticResource PhoneForegroundBrush}"
|
||||
SupportedOrientations="Portrait" Orientation="Portrait"
|
||||
mc:Ignorable="d"
|
||||
shell:SystemTray.IsVisible="True">
|
||||
|
||||
<!--LayoutRoot ist das Stammraster, in dem alle anderen Seiteninhalte platziert werden-->
|
||||
<Grid x:Name="LayoutRoot" Background="Transparent">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--TitlePanel enthält den Namen der Anwendung und den Seitentitel-->
|
||||
<StackPanel Grid.Row="0" Margin="12,17,0,28">
|
||||
<TextBlock Text="Campusapp" Style="{StaticResource PhoneTextNormalStyle}"/>
|
||||
<TextBlock Text="NFC" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!--ContentPanel - zusätzliche Inhalte hier platzieren-->
|
||||
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
|
||||
<StackPanel>
|
||||
<TextBlock Name="Writecontent" Height="500"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Button Content="Write" Name="Write" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Write_Click"/>
|
||||
<Button Content="Prev" Name="Prev" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Prev_Click"/>
|
||||
<Button Content="Next" Name="Next" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Next_Click"/>
|
||||
<Button Content="Read" Name="Read" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Read_Click"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</phone:PhoneApplicationPage>
|
||||
@@ -1,127 +0,0 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="NFC.xaml.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>08.08.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
namespace CampusAppWP8.Pages.Dev
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Windows;
|
||||
using System.Windows.Navigation;
|
||||
using CampusAppWP8.Model.Campusmap;
|
||||
using CampusAppWP8.Model.GeoDb;
|
||||
using CampusAppWP8.Utility.NDEF;
|
||||
using Microsoft.Phone.Controls;
|
||||
using Windows.Networking.Proximity;
|
||||
|
||||
/// <summary>Nfc page.</summary>
|
||||
/// <remarks>Stubbfel, 22.08.2013.</remarks>
|
||||
public partial class NFC : PhoneApplicationPage
|
||||
{
|
||||
/// <summary>The device.</summary>
|
||||
private readonly ProximityDevice device = ProximityDevice.GetDefault();
|
||||
|
||||
/// <summary>Zero-based index of the act ndef.</summary>
|
||||
private int actNDEFIndex;
|
||||
|
||||
/// <summary>List of ndefs.</summary>
|
||||
private List<NDEFMessage> ndefList;
|
||||
|
||||
/// <summary>Initializes a new instance of the NFC class.</summary>
|
||||
/// <remarks>Stubbfel, 22.08.2013.</remarks>
|
||||
public NFC()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.ndefList = new List<NDEFMessage>();
|
||||
MapModel map = new CBMainMapModel();
|
||||
foreach (PlaceModel place in map.Spatial.Places)
|
||||
{
|
||||
this.ndefList.Add(new NDEFMessage(place.ToNfcString(), NDEFMessage.TYPEVAL.TEXT));
|
||||
}
|
||||
|
||||
this.actNDEFIndex = 0;
|
||||
}
|
||||
|
||||
/// <summary>Override the OnNavigatedTo method.</summary>
|
||||
/// <remarks>Stubbfel, 22.08.2013.</remarks>
|
||||
/// <param name="e">Arguments of navigation.</param>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
base.OnNavigatedTo(e);
|
||||
this.Writecontent.Text = this.ndefList[this.actNDEFIndex].GetContent();
|
||||
}
|
||||
|
||||
/// <summary>Handler, called when the publish.</summary>
|
||||
/// <remarks>Stubbfel, 22.08.2013.</remarks>
|
||||
/// <param name="sender"> The sender.</param>
|
||||
/// <param name="messageId">Identifier for the message.</param>
|
||||
private void PublishHandler(ProximityDevice sender, long messageId)
|
||||
{
|
||||
this.device.StopPublishingMessage(messageId);
|
||||
this.Dispatcher.BeginInvoke(new Action(() => MessageBox.Show("Writed:" + this.actNDEFIndex)));
|
||||
}
|
||||
|
||||
/// <summary>Handler, called when the ndef.</summary>
|
||||
/// <remarks>Stubbfel, 22.08.2013.</remarks>
|
||||
/// <param name="sender"> The sender.</param>
|
||||
/// <param name="message">The message.</param>
|
||||
private void NDEFHandler(ProximityDevice sender, ProximityMessage message)
|
||||
{
|
||||
this.device.StopSubscribingForMessage(message.SubscriptionId);
|
||||
var ndefMessage = message.Data;
|
||||
byte[] testa = ndefMessage.ToArray();
|
||||
|
||||
NDEFMessage ndef = new NDEFMessage(testa);
|
||||
this.Dispatcher.BeginInvoke(new Action(() => MessageBox.Show(ndef.GetContent())));
|
||||
}
|
||||
|
||||
/// <summary>Event handler. Called by Read for click events.</summary>
|
||||
/// <remarks>Stubbfel, 22.08.2013.</remarks>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e"> Routed event information.</param>
|
||||
private void Read_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.device.SubscribeForMessage("NDEF", this.NDEFHandler);
|
||||
}
|
||||
|
||||
/// <summary>Event handler. Called by Next for click events.</summary>
|
||||
/// <remarks>Stubbfel, 22.08.2013.</remarks>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e"> Routed event information.</param>
|
||||
private void Next_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (this.actNDEFIndex < this.ndefList.Count - 1)
|
||||
{
|
||||
this.actNDEFIndex++;
|
||||
this.Writecontent.Text = this.ndefList[this.actNDEFIndex].GetContent();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Event handler. Called by Prev for click events.</summary>
|
||||
/// <remarks>Stubbfel, 22.08.2013.</remarks>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e"> Routed event information.</param>
|
||||
private void Prev_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (this.actNDEFIndex > 0)
|
||||
{
|
||||
this.actNDEFIndex--;
|
||||
this.Writecontent.Text = this.ndefList[this.actNDEFIndex].GetContent();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Event handler. Called by Write for click events.</summary>
|
||||
/// <remarks>Stubbfel, 22.08.2013.</remarks>
|
||||
/// <param name="sender">The sender.</param>
|
||||
/// <param name="e"> Routed event information.</param>
|
||||
private void Write_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.device.PublishBinaryMessage("NDEF:WriteTag", this.ndefList[this.actNDEFIndex].ToByteArray().AsBuffer(), this.PublishHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
30
src/ndefpclib/Properties/AssemblyInfo.cs
Normal file
30
src/ndefpclib/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System.Resources;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über folgende
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die einer Assembly zugeordnet sind.
|
||||
[assembly: AssemblyTitle("ndefpclib")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ndefpclib")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: NeutralResourcesLanguage("de")]
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
// durch Einsatz von '*', wie in nachfolgendem Beispiel:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
28
src/ndefpclib/UNLICENSE.t.txt
Normal file
28
src/ndefpclib/UNLICENSE.t.txt
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to [http://unlicense.org]
|
||||
|
||||
|
||||
|
||||
BIN
src/ndefpclib/bin/Debug/ndefpclib.dll
Normal file
BIN
src/ndefpclib/bin/Debug/ndefpclib.dll
Normal file
Binary file not shown.
BIN
src/ndefpclib/bin/Debug/ndefpclib.pdb
Normal file
BIN
src/ndefpclib/bin/Debug/ndefpclib.pdb
Normal file
Binary file not shown.
@@ -1,12 +1,6 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="NDEFMessage.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>21.08.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility.NDEF
|
||||
namespace ndefpclib.message
|
||||
{
|
||||
using ndefpclib.records;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
53
src/ndefpclib/ndefpclib.csproj
Normal file
53
src/ndefpclib/ndefpclib.csproj
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{01C6941E-AAF1-4324-BA54-B4A53BC66ADF}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ndefpclib</RootNamespace>
|
||||
<AssemblyName>ndefpclib</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- A reference to the entire .NET Framework is automatically included -->
|
||||
<Content Include="UNLICENSE.t.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="message\NDEFMessage.cs" />
|
||||
<Compile Include="record\NDEFRecord.cs" />
|
||||
<Compile Include="record\NDEFShortRecord.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,12 +1,6 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="NDEFRecord.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>21.08.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility.NDEF
|
||||
namespace ndefpclib.records
|
||||
{
|
||||
using ndefpclib.message;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
@@ -184,5 +178,3 @@ namespace CampusAppWP8.Utility.NDEF
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
// End of Utility\NDEF\NDEFRecord.cs
|
||||
@@ -1,12 +1,6 @@
|
||||
//-----------------------------------------------------------------------
|
||||
// <copyright file="NDEFShortRecord.cs" company="BTU/IIT">
|
||||
// Company copyright tag.
|
||||
// </copyright>
|
||||
// <author>stubbfel</author>
|
||||
// <sience>21.08.2013</sience>
|
||||
//----------------------------------------------------------------------
|
||||
namespace CampusAppWP8.Utility.NDEF
|
||||
namespace ndefpclib.records
|
||||
{
|
||||
using ndefpclib.message;
|
||||
using System.Text;
|
||||
|
||||
/// <summary>Ndef short record.</summary>
|
||||
Reference in New Issue
Block a user