Merge branch 'LinuxCardReaderService' into Release0.2
# Conflicts: # DataCenter_Windows/WindowsDataCenter/SQLiteRepository/SQLiteRepository.cs # DataCenter_Windows/WindowsDataCenter/WindowsDataCenter/App.config Merged Branch for linux work. Now Deploying Card Reader on RPI.
This commit is contained in:
commit
81975559e2
5
CardReaderService/CardReaderService.conf
Normal file
5
CardReaderService/CardReaderService.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[program:CardReaderService]
|
||||||
|
command=mono-service CardReaderService.exe --no-daemon
|
||||||
|
directory=/DIRECTORYTOSET/CardReaderService
|
||||||
|
stdout_logfile=/DIRECTORYTOSET/CardReaderService/out.log
|
||||||
|
redirect_stderr=true
|
||||||
@ -3,9 +3,18 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio 14
|
# Visual Studio 14
|
||||||
VisualStudioVersion = 14.0.25420.1
|
VisualStudioVersion = 14.0.25420.1
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CardReaderService", "CardReaderService.csproj", "{5F30E8E4-5107-4C99-ADFF-38D735DC113D}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CardReaderService", "CardReaderService\CardReaderService.csproj", "{5F30E8E4-5107-4C99-ADFF-38D735DC113D}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CardReaderServiceHost", "..\CardReaderServiceHost\CardReaderServiceHost.csproj", "{6E48913F-9D8C-4132-93A7-C7B1C6DD5264}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CardReaderServiceHost", "CardReaderServiceHost\CardReaderServiceHost.csproj", "{6E48913F-9D8C-4132-93A7-C7B1C6DD5264}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Logger", "Logger\Logger.csproj", "{42EFE386-DC2E-455A-BA81-5FC9CEE45D02}"
|
||||||
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Linux Conf", "Linux Conf", "{F9053F37-761D-45EE-9153-46776B083DBA}"
|
||||||
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
CardReaderService.conf = CardReaderService.conf
|
||||||
|
install.sh = install.sh
|
||||||
|
uninstall.sh = uninstall.sh
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -21,6 +30,10 @@ Global
|
|||||||
{6E48913F-9D8C-4132-93A7-C7B1C6DD5264}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{6E48913F-9D8C-4132-93A7-C7B1C6DD5264}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{6E48913F-9D8C-4132-93A7-C7B1C6DD5264}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{6E48913F-9D8C-4132-93A7-C7B1C6DD5264}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{6E48913F-9D8C-4132-93A7-C7B1C6DD5264}.Release|Any CPU.Build.0 = Release|Any CPU
|
{6E48913F-9D8C-4132-93A7-C7B1C6DD5264}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{42EFE386-DC2E-455A-BA81-5FC9CEE45D02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{42EFE386-DC2E-455A-BA81-5FC9CEE45D02}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{42EFE386-DC2E-455A-BA81-5FC9CEE45D02}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{42EFE386-DC2E-455A-BA81-5FC9CEE45D02}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
|
||||||
</startup>
|
</startup>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="DataCenterServiceEndpoint" value="http://localhost:1234"/>
|
<add key="DataCenterServiceEndpoint" value="http://localhost:1234"/>
|
||||||
|
|||||||
10
CardReaderService/CardReaderService/CardDataPost.cs
Normal file
10
CardReaderService/CardReaderService/CardDataPost.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace CardReaderService
|
||||||
|
{
|
||||||
|
public class CardDataPost
|
||||||
|
{
|
||||||
|
public DateTime UtcTimeStamp { get; set; }
|
||||||
|
public string CardUId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,9 +9,10 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>CardReaderService</RootNamespace>
|
<RootNamespace>CardReaderService</RootNamespace>
|
||||||
<AssemblyName>CardReaderService</AssemblyName>
|
<AssemblyName>CardReaderService</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@ -33,12 +34,12 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="pcsc-sharp, Version=3.6.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="PCSC, Version=4.2.0.0, Culture=neutral, PublicKeyToken=13b76e54a2ee80a7, processorArchitecture=MSIL">
|
||||||
<HintPath>packages\PCSC.3.6.0\lib\net40\pcsc-sharp.dll</HintPath>
|
<HintPath>..\packages\PCSC.4.2.0\lib\net40\PCSC.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
@ -53,6 +54,11 @@
|
|||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="CardDataPost.cs" />
|
||||||
|
<Compile Include="CircularBuffer.cs" />
|
||||||
|
<Compile Include="ConfigurationManager.cs" />
|
||||||
|
<Compile Include="ConfigurationProperty.cs" />
|
||||||
|
<Compile Include="ConfigurationType.cs" />
|
||||||
<Compile Include="ConfigureService.cs" />
|
<Compile Include="ConfigureService.cs" />
|
||||||
<Compile Include="DataCenterHelper.cs" />
|
<Compile Include="DataCenterHelper.cs" />
|
||||||
<Compile Include="Service1.cs">
|
<Compile Include="Service1.cs">
|
||||||
@ -68,6 +74,12 @@
|
|||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\Logger\Logger.csproj">
|
||||||
|
<Project>{42EFE386-DC2E-455A-BA81-5FC9CEE45D02}</Project>
|
||||||
|
<Name>Logger</Name>
|
||||||
|
</ProjectReference>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- 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.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
38
CardReaderService/CardReaderService/ConfigurationManager.cs
Normal file
38
CardReaderService/CardReaderService/ConfigurationManager.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
using System;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace CardReaderService
|
||||||
|
{
|
||||||
|
public class ConfigurationManager
|
||||||
|
{
|
||||||
|
public ConfigurationProperty GetConfiguration(string configName)
|
||||||
|
{
|
||||||
|
var cfgManager = GetConfigManager();
|
||||||
|
if (cfgManager.AppSettings.Settings.AllKeys.Contains(configName))
|
||||||
|
{
|
||||||
|
var cfg = cfgManager.AppSettings.Settings[configName];
|
||||||
|
return new ConfigurationProperty
|
||||||
|
{
|
||||||
|
Group=string.Empty,
|
||||||
|
Id="NOTIMPLEMENTED",
|
||||||
|
Name = cfg.Key,
|
||||||
|
Value = cfg.Value,
|
||||||
|
ReadOnly = false,
|
||||||
|
Source = "CardReaderService",
|
||||||
|
Type = ConfigurationType.STRING
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Configuration GetConfigManager()
|
||||||
|
{
|
||||||
|
return System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string ConfigFilePath => new Uri(Assembly.GetEntryAssembly().CodeBase).LocalPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
55
CardReaderService/CardReaderService/ConfigurationProperty.cs
Normal file
55
CardReaderService/CardReaderService/ConfigurationProperty.cs
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
namespace CardReaderService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An object used to detail an element that can be configured in the system.
|
||||||
|
/// </summary>
|
||||||
|
public class ConfigurationProperty
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Unique Id for the configuration property.
|
||||||
|
/// </summary>
|
||||||
|
public string Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// The display name of the configuration
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The group under which this configuration falls (e.g.: TCP Settings - "TCP" or similar.)
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Application Specific grouping.</remarks>
|
||||||
|
public string Group { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The actual value of the Configuration property
|
||||||
|
/// </summary>
|
||||||
|
public string Value { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The source of the configuration properties.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Using this property allows aggregation of configuration settings
|
||||||
|
/// by any configuration managers
|
||||||
|
/// </remarks>
|
||||||
|
/// <example>{TYPE}.getType().Name (or other suitably unique identifier)</example>
|
||||||
|
public string Source { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The type of the configuration
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This can be used for UI proofing/validation to ensure a user
|
||||||
|
/// enters expected format (e.g.: enters a date time for a datetime type)
|
||||||
|
/// </remarks>
|
||||||
|
public ConfigurationType Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Specifies whether the configuration setting can be set by user or is readonly
|
||||||
|
/// </summary>
|
||||||
|
public bool ReadOnly { get; set; }
|
||||||
|
|
||||||
|
//TODO: in future, add access level, could go read level/edit level
|
||||||
|
//public UserAccessLevel UserLevel {get;set;}
|
||||||
|
}
|
||||||
|
}
|
||||||
33
CardReaderService/CardReaderService/ConfigurationType.cs
Normal file
33
CardReaderService/CardReaderService/ConfigurationType.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
namespace CardReaderService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The type of the configuration.
|
||||||
|
/// </summary>
|
||||||
|
public enum ConfigurationType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// No Type - shouldnt be used, but default for enum
|
||||||
|
/// </summary>
|
||||||
|
NONE,
|
||||||
|
/// <summary>
|
||||||
|
/// a string type configuration (could also be used for complex objects, e.g.: a json string/object).
|
||||||
|
/// </summary>
|
||||||
|
STRING,
|
||||||
|
/// <summary>
|
||||||
|
/// A whole number configuration
|
||||||
|
/// </summary>
|
||||||
|
INT,
|
||||||
|
/// <summary>
|
||||||
|
/// A number config with a decimal component
|
||||||
|
/// </summary>
|
||||||
|
DECIMAL,
|
||||||
|
/// <summary>
|
||||||
|
/// A Date Time Configuration
|
||||||
|
/// </summary>
|
||||||
|
DATETIME,
|
||||||
|
/// <summary>
|
||||||
|
/// A Boolean/TrueFalse configuration property (e.g.: On Off)
|
||||||
|
/// </summary>
|
||||||
|
BOOL
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,36 +1,40 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Logger;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace CardReaderService
|
namespace CardReaderService
|
||||||
{
|
{
|
||||||
static class DataCenterHelper
|
static class DataCenterHelper
|
||||||
{
|
{
|
||||||
|
static DataCenterHelper()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public static void Post(CardDataPost postObject, string url)
|
public static void Post(CardDataPost postObject, string url)
|
||||||
{
|
{
|
||||||
var endpointConfig = ConfigurationManager.AppSettings["DataCenterServiceEndpoint"] ??
|
var cfgMgr = new ConfigurationManager();
|
||||||
"http://localhost:8800";
|
//using ConfigurationManager means we can change the value at runtime without having to restart the service.
|
||||||
|
var endpointConfig = cfgMgr.GetConfiguration("DataCenterServiceEndpoint")?.Value?? "http://localhost:8800";
|
||||||
|
|
||||||
|
MessageLogger.Log("Targeting Endpoint: " + endpointConfig);
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
var jsonObject = JsonConvert.SerializeObject(postObject);
|
var jsonObject = JsonConvert.SerializeObject(postObject);
|
||||||
var content = new StringContent(jsonObject, Encoding.UTF8, "application/json");
|
var content = new StringContent(jsonObject, Encoding.UTF8, "application/json");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Console.WriteLine("Writing");
|
MessageLogger.Log("Writing uid: "+ postObject.CardUId + " to the server.");
|
||||||
var fullUrl = endpointConfig + url;
|
var fullUrl = endpointConfig + url;
|
||||||
|
MessageLogger.Log("Writing to URL: " + fullUrl);
|
||||||
var response = client.PostAsync(fullUrl, content).Result;
|
var response = client.PostAsync(fullUrl, content).Result;
|
||||||
Console.WriteLine("Written");
|
MessageLogger.Log("Successfully written to server");
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
Console.WriteLine("exceptioning");
|
MessageLogger.Log("Failed to send log to server.");
|
||||||
//ignore
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,9 +44,4 @@ namespace CardReaderService
|
|||||||
return Task.Run(() => Post(postObject, url));
|
return Task.Run(() => Post(postObject, url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CardDataPost
|
|
||||||
{
|
|
||||||
public string CardUId { get; set; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
using PCSC;
|
using PCSC;
|
||||||
using System;
|
using System;
|
||||||
|
using System.CodeDom;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.ServiceProcess;
|
using System.ServiceProcess;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using Logger;
|
||||||
|
using PCSC.Monitoring;
|
||||||
|
|
||||||
namespace CardReaderService
|
namespace CardReaderService
|
||||||
{
|
{
|
||||||
@ -12,14 +15,15 @@ namespace CardReaderService
|
|||||||
{
|
{
|
||||||
private Thread _mainWorkThread;
|
private Thread _mainWorkThread;
|
||||||
private bool _stopMainWorkerThread;
|
private bool _stopMainWorkerThread;
|
||||||
private AutoResetEvent _mainWorkerTerminationSignal;
|
private readonly ManualResetEvent _mre;
|
||||||
private string _readerName = "";
|
|
||||||
|
private string _readerName = string.Empty;
|
||||||
private SCardMonitor _cardMonitor;
|
private SCardMonitor _cardMonitor;
|
||||||
private bool _initialised=false;
|
|
||||||
|
|
||||||
public Service1()
|
public Service1()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_mre = new ManualResetEvent(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Start()
|
public void Start()
|
||||||
@ -27,44 +31,54 @@ namespace CardReaderService
|
|||||||
OnStart(new string[] { });
|
OnStart(new string[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnStart(string[] args)
|
public new void Stop()
|
||||||
{
|
|
||||||
StartWorkerThread();
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool WeHaveValidCardReader()
|
|
||||||
{
|
|
||||||
if (_cardMonitor == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
Console.WriteLine(_cardMonitor.GetCurrentState(0));
|
|
||||||
if (_cardMonitor.GetCurrentState(0) == SCRState.Unknown
|
|
||||||
|| _cardMonitor.GetCurrentState(0) == SCRState.Unavailable
|
|
||||||
|| _cardMonitor.GetCurrentState(0) == (SCRState.Ignore | SCRState.Unavailable)
|
|
||||||
//|| _cardMonitor.GetCurrentState(0) == SCRState.Unaware //if we say this is an invalid state, we cause a memory leak where we create a duplicate card monitor, subscribe and overwrite.
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Stop()
|
|
||||||
{
|
{
|
||||||
OnStop();
|
OnStop();
|
||||||
|
base.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnStart(string[] args)
|
||||||
|
{
|
||||||
|
MessageLogger.Log("Starting.. ");
|
||||||
|
var ctxFactory = ContextFactory.Instance;
|
||||||
|
using (var context = ctxFactory.Establish(SCardScope.System))
|
||||||
|
{
|
||||||
|
MessageLogger.Log("Getting Card Readers");
|
||||||
|
var readerNames = context.GetReaders();
|
||||||
|
if (NoReaderAvailable(readerNames))
|
||||||
|
{
|
||||||
|
MessageLogger.Log("No Card Reader available, Exiting..");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageLogger.Log("Choosing first available reader: " + readerNames.First());
|
||||||
|
_readerName = readerNames.First();
|
||||||
|
_cardMonitor = new SCardMonitor(ctxFactory, SCardScope.System);
|
||||||
|
_cardMonitor.CardInserted += CardMonitor_CardInserted;
|
||||||
|
_cardMonitor.StatusChanged += CardMonitorOnStatusChanged;
|
||||||
|
_cardMonitor.Start(_readerName);
|
||||||
|
}
|
||||||
|
StartWorkerThread();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnStop()
|
protected override void OnStop()
|
||||||
{
|
{
|
||||||
|
MessageLogger.Log("Stopping..");
|
||||||
_stopMainWorkerThread = true;
|
_stopMainWorkerThread = true;
|
||||||
_mainWorkerTerminationSignal.Set();
|
_mre.Set();
|
||||||
if (_mainWorkThread != null && _mainWorkThread.IsAlive)
|
if (_mainWorkThread != null && _mainWorkThread.IsAlive)
|
||||||
|
{
|
||||||
|
_mainWorkThread.Join(3000);
|
||||||
|
if (_mainWorkThread.IsAlive)
|
||||||
{
|
{
|
||||||
_mainWorkThread.Interrupt();
|
_mainWorkThread.Interrupt();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (_cardMonitor != null)
|
if (_cardMonitor != null)
|
||||||
{
|
{
|
||||||
|
_cardMonitor.CardInserted -= CardMonitor_CardInserted;
|
||||||
|
_cardMonitor.StatusChanged -= CardMonitorOnStatusChanged;
|
||||||
_cardMonitor.Cancel();
|
_cardMonitor.Cancel();
|
||||||
_cardMonitor.Dispose();
|
_cardMonitor.Dispose();
|
||||||
_cardMonitor = null;
|
_cardMonitor = null;
|
||||||
@ -79,96 +93,110 @@ namespace CardReaderService
|
|||||||
Name = "CardServiceMainThread",
|
Name = "CardServiceMainThread",
|
||||||
IsBackground = false
|
IsBackground = false
|
||||||
};
|
};
|
||||||
_mainWorkerTerminationSignal = new AutoResetEvent(false);
|
|
||||||
_mainWorkThread.Start();
|
_mainWorkThread.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _cardMonitor_CardInserted(object sender, CardStatusEventArgs e)
|
private void CardMonitor_CardInserted(object sender, CardStatusEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var ctxFac = ContextFactory.Instance;
|
var ctxFac = ContextFactory.Instance;
|
||||||
using (var ctx = ctxFac.Establish(SCardScope.System))
|
using (var ctx = ctxFac.Establish(SCardScope.System))
|
||||||
{
|
{
|
||||||
var reader = new SCardReader(ctx);
|
var reader = new SCardReader(ctx);
|
||||||
var pioSendPci = new IntPtr();
|
|
||||||
byte[] rcvBuffer = new byte[256];
|
byte[] rcvBuffer = new byte[256];
|
||||||
|
|
||||||
if (_readerName == string.Empty)
|
if (_readerName == string.Empty)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Reader name is somehow empty... WTF!");
|
MessageLogger.Log("Reader name is somehow empty... WTF!");
|
||||||
_stopMainWorkerThread = true;
|
_stopMainWorkerThread = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var err = reader.Connect(_readerName, SCardShareMode.Shared, SCardProtocol.T0 | SCardProtocol.T1);
|
var err = reader.Connect(_readerName, SCardShareMode.Shared, SCardProtocol.Any);
|
||||||
|
|
||||||
if (err == SCardError.Success)
|
if (err == SCardError.Success)
|
||||||
{
|
{
|
||||||
var uIdcmd = new byte[] { 0xFF, 0xCA, 0x00, 0x00, 0x00 };
|
var pci = SCardPCI.GetPci(reader.ActiveProtocol);
|
||||||
|
|
||||||
|
err = reader.Transmit(pci, CardCommands.GetUid, ref rcvBuffer);
|
||||||
|
|
||||||
err = reader.Transmit(pioSendPci, uIdcmd, ref rcvBuffer);
|
|
||||||
if (err == SCardError.Success)
|
if (err == SCardError.Success)
|
||||||
{
|
{
|
||||||
var uid = ConvertByteUIDToString(rcvBuffer);
|
var uid = ConvertByteUIDToString(rcvBuffer);
|
||||||
var atrString = ConvertByteUIDToString(e.Atr);
|
var atrString = ConvertByteUIDToString(e.Atr);
|
||||||
Console.WriteLine("Card Inserted, ATR: " + atrString + ", and UID is: " + uid);
|
|
||||||
|
|
||||||
CardDataPost postObj = new CardDataPost { CardUId = uid };
|
MessageLogger.Log("Card Inserted, ATR: " + atrString + ", and UID is: " + uid);
|
||||||
|
|
||||||
|
CardDataPost postObj = new CardDataPost { CardUId = uid, UtcTimeStamp = DateTime.UtcNow };
|
||||||
DataCenterHelper.PostAsync(postObj, "/api/swipedata");
|
DataCenterHelper.PostAsync(postObj, "/api/swipedata");
|
||||||
Console.WriteLine("Posted to Server");
|
MessageLogger.Log("Posted to Server");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageLogger.Log("Failed to Read UID, Error: " + err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine("Reader failed to connect, error: " + Enum.GetName(typeof(SCardError), err));
|
MessageLogger.Log("Reader failed to connect, error: " + Enum.GetName(typeof(SCardError), err));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
MessageLogger.Log("Exception has occurred in Card Inserted Event handler. Exception: "+ ex);
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainWorkerThread()
|
private void MainWorkerThread()
|
||||||
{
|
{
|
||||||
|
var minimumLoopTimemS = 5000;
|
||||||
|
|
||||||
while (!_stopMainWorkerThread)
|
while (!_stopMainWorkerThread)
|
||||||
{
|
{
|
||||||
if (!WeHaveValidCardReader())
|
if (_cardMonitor == null)
|
||||||
{ //only do this if we don't have a valid card reader
|
|
||||||
if (_initialised)
|
|
||||||
{
|
{
|
||||||
//card reader no longer available, tidy up.
|
|
||||||
_cardMonitor.Cancel();
|
|
||||||
_cardMonitor.CardInserted -= _cardMonitor_CardInserted;
|
|
||||||
_cardMonitor.Dispose();
|
|
||||||
_cardMonitor = null;
|
|
||||||
_initialised = false;
|
|
||||||
}
|
|
||||||
Console.WriteLine("Starting.. Getting available readers");
|
|
||||||
var ctxFactory = ContextFactory.Instance;
|
var ctxFactory = ContextFactory.Instance;
|
||||||
using (var context = ctxFactory.Establish(SCardScope.System))
|
using (var context = ctxFactory.Establish(SCardScope.System))
|
||||||
{
|
{
|
||||||
var readerNames = context.GetReaders();
|
var readerNames = context.GetReaders();
|
||||||
if (!NoReaderAvailable(readerNames))
|
if (NoReaderAvailable(readerNames))
|
||||||
{
|
{
|
||||||
//we have a reader available, so initialise!
|
MessageLogger.Log("No Card Reader available, Waiting..");
|
||||||
Console.WriteLine("Choosing first available reader: " + readerNames.First());
|
|
||||||
_readerName = readerNames.First();
|
|
||||||
_cardMonitor = new SCardMonitor(ctxFactory, SCardScope.System);
|
|
||||||
_cardMonitor.CardInserted += _cardMonitor_CardInserted;
|
|
||||||
_cardMonitor.Start(_readerName);
|
|
||||||
|
|
||||||
_initialised = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Console.WriteLine("No Card Reader is available..");
|
MessageLogger.Log("Choosing first available reader: " + readerNames.First());
|
||||||
|
_readerName = readerNames.First();
|
||||||
|
_cardMonitor = new SCardMonitor(ctxFactory, SCardScope.System);
|
||||||
|
_cardMonitor.CardInserted += CardMonitor_CardInserted;
|
||||||
|
_cardMonitor.StatusChanged += CardMonitorOnStatusChanged;
|
||||||
|
_cardMonitor.Start(_readerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_mainWorkerTerminationSignal.WaitOne(3000);
|
//dont actually need to do anything.. but cannot exit right away?
|
||||||
|
_mre.WaitOne(minimumLoopTimemS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CardMonitorOnStatusChanged(object sender, StatusChangeEventArgs e)
|
||||||
|
{
|
||||||
|
if ((e.NewState & SCRState.Unavailable) == SCRState.Unavailable && (e.NewState & SCRState.Ignore) == SCRState.Ignore)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Card Reader Disconnected");
|
||||||
|
_cardMonitor.CardInserted -= CardMonitor_CardInserted;
|
||||||
|
_cardMonitor.Cancel();
|
||||||
|
_cardMonitor.Dispose();
|
||||||
|
_cardMonitor = null;
|
||||||
|
_readerName = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string ConvertByteUIDToString(byte[] uid)
|
private string ConvertByteUIDToString(byte[] uid)
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
foreach (var b in uid)
|
foreach (var b in uid)
|
||||||
{
|
{
|
||||||
@ -183,4 +211,9 @@ namespace CardReaderService
|
|||||||
return readerNames == null || readerNames.Count < 1;
|
return readerNames == null || readerNames.Count < 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal class CardCommands
|
||||||
|
{
|
||||||
|
public static readonly byte[] GetUid = {0xFF, 0xCA, 0x00, 0x00, 0x08};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
|
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net45" />
|
||||||
<package id="PCSC" version="3.6.0" targetFramework="net452" />
|
<package id="PCSC" version="4.2.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
|
||||||
</startup>
|
</startup>
|
||||||
</configuration>
|
</configuration>
|
||||||
@ -9,9 +9,10 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>CardReaderServiceHost</RootNamespace>
|
<RootNamespace>CardReaderServiceHost</RootNamespace>
|
||||||
<AssemblyName>CardReaderServiceHost</AssemblyName>
|
<AssemblyName>CardReaderServiceHost</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@ -33,8 +34,8 @@
|
|||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<HintPath>..\CardReaderService\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
@ -52,6 +53,18 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Include="..\CardReaderService.conf">
|
||||||
|
<Link>CardReaderService.conf</Link>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="..\install.sh">
|
||||||
|
<Link>install.sh</Link>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="..\uninstall.sh">
|
||||||
|
<Link>uninstall.sh</Link>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@ -9,7 +9,7 @@ namespace CardReaderServiceHost
|
|||||||
{
|
{
|
||||||
Service1 service1 = new Service1();
|
Service1 service1 = new Service1();
|
||||||
service1.Start();
|
service1.Start();
|
||||||
Console.WriteLine("Service Running...");
|
Console.WriteLine("Service Running... Enter To Stop");
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
service1.Stop();
|
service1.Stop();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
|
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
55
CardReaderService/Logger/Logger.csproj
Normal file
55
CardReaderService/Logger/Logger.csproj
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="14.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>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
<ProjectGuid>{42EFE386-DC2E-455A-BA81-5FC9CEE45D02}</ProjectGuid>
|
||||||
|
<OutputType>Library</OutputType>
|
||||||
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
|
<RootNamespace>Logger</RootNamespace>
|
||||||
|
<AssemblyName>Logger</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
|
</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>
|
||||||
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Core" />
|
||||||
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="System.Data.DataSetExtensions" />
|
||||||
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
<Reference Include="System.Data" />
|
||||||
|
<Reference Include="System.Net.Http" />
|
||||||
|
<Reference Include="System.Xml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="MessageLogger.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildToolsPath)\Microsoft.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>
|
||||||
20
CardReaderService/Logger/MessageLogger.cs
Normal file
20
CardReaderService/Logger/MessageLogger.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Logger
|
||||||
|
{
|
||||||
|
public class MessageLogger
|
||||||
|
{
|
||||||
|
private static string _logPath = "log.txt";
|
||||||
|
|
||||||
|
public static void Log(string message)
|
||||||
|
{
|
||||||
|
Console.WriteLine(message);
|
||||||
|
File.AppendAllText(_logPath, string.Format("{0} | {1}{2}", DateTime.Now, message, Environment.NewLine));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
36
CardReaderService/Logger/Properties/AssemblyInfo.cs
Normal file
36
CardReaderService/Logger/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
// General Information about an assembly is controlled through the following
|
||||||
|
// set of attributes. Change these attribute values to modify the information
|
||||||
|
// associated with an assembly.
|
||||||
|
[assembly: AssemblyTitle("Logger")]
|
||||||
|
[assembly: AssemblyDescription("")]
|
||||||
|
[assembly: AssemblyConfiguration("")]
|
||||||
|
[assembly: AssemblyCompany("")]
|
||||||
|
[assembly: AssemblyProduct("Logger")]
|
||||||
|
[assembly: AssemblyCopyright("Copyright © 2017")]
|
||||||
|
[assembly: AssemblyTrademark("")]
|
||||||
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
// Setting ComVisible to false makes the types in this assembly not visible
|
||||||
|
// to COM components. If you need to access a type in this assembly from
|
||||||
|
// COM, set the ComVisible attribute to true on that type.
|
||||||
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
|
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||||
|
[assembly: Guid("42efe386-dc2e-455a-ba81-5fc9cee45d02")]
|
||||||
|
|
||||||
|
// Version information for an assembly consists of the following four values:
|
||||||
|
//
|
||||||
|
// Major Version
|
||||||
|
// Minor Version
|
||||||
|
// Build Number
|
||||||
|
// Revision
|
||||||
|
//
|
||||||
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
|
// by using the '*' as shown below:
|
||||||
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
[assembly: AssemblyVersion("1.0.0.0")]
|
||||||
|
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||||
7
CardReaderService/dependencies.txt
Normal file
7
CardReaderService/dependencies.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
install:
|
||||||
|
- pcscd
|
||||||
|
- supervisor
|
||||||
|
- mono-complete
|
||||||
|
|
||||||
|
copy CardReaderService.conf to /home/osboxes/CardReaderService
|
||||||
|
|
||||||
24
CardReaderService/install.sh
Normal file
24
CardReaderService/install.sh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo "No arguments supplied, supply the base path"
|
||||||
|
fi
|
||||||
|
echo "Installing dependencies"
|
||||||
|
apt-get install mono-complete pcscd supervisor -y
|
||||||
|
|
||||||
|
echo "Modifying supervisor conf file"
|
||||||
|
sed -i "s|/DIRECTORYTOSET|$1|g" CardReaderService.conf
|
||||||
|
|
||||||
|
echo "Installing service configuration file"
|
||||||
|
cp CardReaderService.conf /etc/supervisor/conf.d/
|
||||||
|
|
||||||
|
echo "Installing applicaton"
|
||||||
|
mkdir $1/CardReaderService
|
||||||
|
cp ./*.* $1/CardReaderService
|
||||||
|
cd $1/CardReaderService
|
||||||
|
rm *.pdb
|
||||||
|
rm *.vshost.exe
|
||||||
|
rm *.vshost.exe.config
|
||||||
|
rm *.vshost.exe.manifest
|
||||||
|
echo "Starting application........."
|
||||||
|
service supervisor restart
|
||||||
12
CardReaderService/uninstall.sh
Normal file
12
CardReaderService/uninstall.sh
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
if [ -z "$1" ]
|
||||||
|
then
|
||||||
|
echo "No arguments supplied, supply the base path"
|
||||||
|
fi
|
||||||
|
echo "Stopping service...."
|
||||||
|
service supervisor stop
|
||||||
|
rm -f /etc/supervisor/conf.d/CardReaderService.conf
|
||||||
|
echo "Removing Application.."
|
||||||
|
rm -r -f $1/CardReaderService
|
||||||
|
echo "Removing application dependencies.."
|
||||||
|
apt-get remove pcscd supervisor mono-complete -y
|
||||||
@ -1,10 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||||
</startup>
|
</startup>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="NLogConfigFilePath" value="Configs/NLogConfig.xml" />
|
<add key="NLogConfigFilePath" value="Configs/NLogConfig.xml" />
|
||||||
<add key="DataCenterServiceEndpoint" value="http://localhost:8800" />
|
<add key="DataCenterServiceEndpoint" value="http://localhost:8800" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
@ -9,9 +9,10 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>CardReaderService</RootNamespace>
|
<RootNamespace>CardReaderService</RootNamespace>
|
||||||
<AssemblyName>CardReaderService</AssemblyName>
|
<AssemblyName>CardReaderService</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@ -85,6 +86,7 @@
|
|||||||
<Compile Include="ConfigureService.cs" />
|
<Compile Include="ConfigureService.cs" />
|
||||||
<Compile Include="DataCenterHelper.cs" />
|
<Compile Include="DataCenterHelper.cs" />
|
||||||
<Compile Include="DefaultComponents\DefaultLogger.cs" />
|
<Compile Include="DefaultComponents\DefaultLogger.cs" />
|
||||||
|
<Compile Include="DefaultComponents\LogFileLogger.cs" />
|
||||||
<Compile Include="NinjectHelper.cs" />
|
<Compile Include="NinjectHelper.cs" />
|
||||||
<Compile Include="CardReaderService.cs">
|
<Compile Include="CardReaderService.cs">
|
||||||
<SubType>Component</SubType>
|
<SubType>Component</SubType>
|
||||||
|
|||||||
@ -0,0 +1,122 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Interfaces;
|
||||||
|
|
||||||
|
namespace CardReaderService.DefaultComponents
|
||||||
|
{
|
||||||
|
class LogFileLogger: ILogger
|
||||||
|
{
|
||||||
|
public bool IsDebugEnabled => true;
|
||||||
|
public bool IsErrorEnabled => true;
|
||||||
|
public bool IsFatalEnabled => true;
|
||||||
|
public bool IsInfoEnabled => true;
|
||||||
|
public bool IsTraceEnabled => true;
|
||||||
|
public bool IsWarnEnabled => true;
|
||||||
|
|
||||||
|
public void Debug(Exception exception)
|
||||||
|
{
|
||||||
|
Log(exception.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Debug(string format, params object[] args)
|
||||||
|
{
|
||||||
|
Log(string.Format(format, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Debug(Exception exception, string format, params object[] args)
|
||||||
|
{
|
||||||
|
Log(exception.ToString());
|
||||||
|
Log(string.Format(format, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Error(Exception exception)
|
||||||
|
{
|
||||||
|
Log(exception.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Error(string format, params object[] args)
|
||||||
|
{
|
||||||
|
Log(string.Format(format, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Error(Exception exception, string format, params object[] args)
|
||||||
|
{
|
||||||
|
Log(exception.ToString());
|
||||||
|
Log(string.Format(format, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Fatal(Exception exception)
|
||||||
|
{
|
||||||
|
Log(exception.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Fatal(string format, params object[] args)
|
||||||
|
{
|
||||||
|
Log(string.Format(format, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Fatal(Exception exception, string format, params object[] args)
|
||||||
|
{
|
||||||
|
Log(exception.ToString());
|
||||||
|
Log(string.Format(format, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Info(Exception exception)
|
||||||
|
{
|
||||||
|
Log(exception.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Info(string format, params object[] args)
|
||||||
|
{
|
||||||
|
Log(string.Format(format, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Info(Exception exception, string format, params object[] args)
|
||||||
|
{
|
||||||
|
Log(exception.ToString());
|
||||||
|
Log(string.Format(format, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Trace(Exception exception)
|
||||||
|
{
|
||||||
|
Log(exception.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Trace(string format, params object[] args)
|
||||||
|
{
|
||||||
|
Log(string.Format(format, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Trace(Exception exception, string format, params object[] args)
|
||||||
|
{
|
||||||
|
Log(exception.ToString());
|
||||||
|
Log(string.Format(format, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Warn(Exception exception)
|
||||||
|
{
|
||||||
|
Log(exception.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Warn(string format, params object[] args)
|
||||||
|
{
|
||||||
|
Log(string.Format(format, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Warn(Exception exception, string format, params object[] args)
|
||||||
|
{
|
||||||
|
Log(exception.ToString());
|
||||||
|
Log(string.Format(format, args));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string _logPath = "log.txt";
|
||||||
|
|
||||||
|
public static void Log(string message)
|
||||||
|
{
|
||||||
|
System.IO.File.WriteAllText(_logPath, string.Format("{0} | {1}", DateTime.Now, message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<module name="NinjectAssemblies">
|
<module name="NinjectAssemblies">
|
||||||
<bind service="Interfaces.ILogger, Interfaces"
|
<bind service="Interfaces.ILogger, Interfaces"
|
||||||
to="NLogLogger.NLogger, NLogLogger" scope="singleton" />
|
to="CardReaderService.DefaultComponents.LogFileLogger, CardReaderService" scope="singleton" />
|
||||||
</module>
|
</module>
|
||||||
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
|
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
|
||||||
<package id="Ninject" version="3.2.2.0" targetFramework="net452" />
|
<package id="Ninject" version="3.3.4" targetFramework="net45" />
|
||||||
<package id="Ninject.Extensions.Xml" version="3.2.0.0" targetFramework="net452" />
|
<package id="Ninject.Extensions.Xml" version="3.3.0" targetFramework="net45" />
|
||||||
<package id="PCSC" version="3.6.0" targetFramework="net452" />
|
<package id="PCSC" version="3.6.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
@ -7,4 +7,12 @@
|
|||||||
<add key="NLogConfigFilePath" value="Configs/NLogConfig.xml" />
|
<add key="NLogConfigFilePath" value="Configs/NLogConfig.xml" />
|
||||||
<add key="DataCenterServiceEndpoint" value="http://localhost:1234" />
|
<add key="DataCenterServiceEndpoint" value="http://localhost:1234" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
@ -9,8 +9,9 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>ConfigurationHandler</RootNamespace>
|
<RootNamespace>ConfigurationHandler</RootNamespace>
|
||||||
<AssemblyName>ConfigurationHandler</AssemblyName>
|
<AssemblyName>ConfigurationHandler</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
|||||||
@ -96,10 +96,12 @@ namespace Interfaces
|
|||||||
/// <see cref="Identifier"/> object with the Unique Id triggering the event
|
/// <see cref="Identifier"/> object with the Unique Id triggering the event
|
||||||
/// </param>
|
/// </param>
|
||||||
/// <param name="logId">The resultant Id of the inserted TimeLog</param>
|
/// <param name="logId">The resultant Id of the inserted TimeLog</param>
|
||||||
|
/// <param name="logTime">Optional - To set the log time of the swipe.
|
||||||
|
/// <remarks>Particularly useful for buffering logs in nodes if they cannot contact server for whatever reason to minimise data loss</remarks></param>
|
||||||
/// <returns>
|
/// <returns>
|
||||||
/// <see cref="OperationResponse"/> to indicate procedure status.
|
/// <see cref="OperationResponse"/> to indicate procedure status.
|
||||||
/// </returns>
|
/// </returns>
|
||||||
LogEventResponse LogEventTime(Identifier identifier, out int logId);
|
LogEventResponse LogEventTime(Identifier identifier, out int logId, DateTime logTime = default(DateTime));
|
||||||
|
|
||||||
OperationResponse CreateGroup(Group group, out int groupId);
|
OperationResponse CreateGroup(Group group, out int groupId);
|
||||||
List<Group> GetGroups(int userId = -1);
|
List<Group> GetGroups(int userId = -1);
|
||||||
|
|||||||
@ -9,8 +9,9 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Interfaces</RootNamespace>
|
<RootNamespace>Interfaces</RootNamespace>
|
||||||
<AssemblyName>Interfaces</AssemblyName>
|
<AssemblyName>Interfaces</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
|||||||
@ -304,8 +304,20 @@ namespace SQLiteRepository
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LogEventResponse LogEventTime(Identifier identifier, out int logId)
|
public LogEventResponse LogEventTime(Identifier identifier, out int logId, DateTime logTime = default(DateTime))
|
||||||
{
|
{
|
||||||
|
#region Set the LogTime before we start querying anything.
|
||||||
|
if (logTime == default(DateTime))
|
||||||
|
{
|
||||||
|
logTime = DateTime.UtcNow;
|
||||||
|
_logger.Debug("Using own log time: {0}", logTime.ToString("o"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.Debug("Using supplied log time: {0}", logTime.ToString("o"));
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
var ret = new LogEventResponse();
|
var ret = new LogEventResponse();
|
||||||
var cardIdQuery = _connection.Query<CardUniqueId>(
|
var cardIdQuery = _connection.Query<CardUniqueId>(
|
||||||
SQLiteProcedures.GET_CARDS_BY_UNIQUE_ID,
|
SQLiteProcedures.GET_CARDS_BY_UNIQUE_ID,
|
||||||
@ -359,7 +371,7 @@ namespace SQLiteRepository
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Get the current time (for swiping). and calendar week/year to help recall the data.
|
#region Get the current time (for swiping). and calendar week/year to help recall the data.
|
||||||
var logTime = DateTime.UtcNow;
|
|
||||||
var calendarWeek = GetIso8601CalendarWeek(logTime);
|
var calendarWeek = GetIso8601CalendarWeek(logTime);
|
||||||
var year = logTime.Year;
|
var year = logTime.Year;
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
<add key="DefaultPageSize" value="20" />
|
<add key="DefaultPageSize" value="20" />
|
||||||
<add key="WebsiteHttpPort" value="8800" />
|
<add key="WebsiteHttpPort" value="8800" />
|
||||||
<add key="SwipeTimeGap" value="3" />
|
<add key="SwipeTimeGap" value="3" />
|
||||||
<add key="BugSubmissionEmailAddress" value="incoming+WattsC/FlexiTimeTrackerTool@incoming.gitlab.com"/>
|
<add key="BugSubmissionEmailAddress" value="incoming+WattsC/FlexiTimeTrackerTool+24qrefn8e1urhl4iqct7we2jl@gitlab.com" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||||
@ -18,7 +18,7 @@
|
|||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
|
<bindingRedirect oldVersion="0.0.0.0-3.1.0.0" newVersion="3.1.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
@ -36,6 +36,18 @@
|
|||||||
<assemblyIdentity name="System.Web.Http.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
<assemblyIdentity name="System.Web.Http.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Ninject.Web.Common" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.3.1.0" newVersion="3.3.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Ninject.Web.Common.OwinHost" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.3.1.0" newVersion="3.3.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
@ -1,7 +1,10 @@
|
|||||||
namespace WindowsDataCenter
|
using System;
|
||||||
|
|
||||||
|
namespace WindowsDataCenter
|
||||||
{
|
{
|
||||||
public class CardData
|
public class CardData
|
||||||
{
|
{
|
||||||
|
public DateTime? UtcTimeStamp { get; set; }
|
||||||
public string CardUId { get; set; }
|
public string CardUId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -38,7 +38,13 @@ namespace WindowsDataCenter
|
|||||||
public IHttpActionResult PostData([FromBody] CardData cData)
|
public IHttpActionResult PostData([FromBody] CardData cData)
|
||||||
{
|
{
|
||||||
int logId;
|
int logId;
|
||||||
var resp = _repo.LogEventTime(new Identifier {UniqueId = cData.CardUId}, out logId);
|
|
||||||
|
var id = new Identifier {UniqueId = cData.CardUId};
|
||||||
|
|
||||||
|
var resp = cData.UtcTimeStamp.HasValue
|
||||||
|
? _repo.LogEventTime(id, out logId, cData.UtcTimeStamp.Value)
|
||||||
|
: _repo.LogEventTime(id, out logId);
|
||||||
|
|
||||||
_logger.Trace("Received new \"Swipe Event\" for UId: {0} at {1}, direction is : {2}", cData.CardUId,
|
_logger.Trace("Received new \"Swipe Event\" for UId: {0} at {1}, direction is : {2}", cData.CardUId,
|
||||||
DateTime.UtcNow, resp.Direction);
|
DateTime.UtcNow, resp.Direction);
|
||||||
return Ok(new {Id = logId, resp.Direction});
|
return Ok(new {Id = logId, resp.Direction});
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="Castle.Core" version="4.2.0" targetFramework="net452" />
|
||||||
<package id="DalSoft.WebApi.HelpPage" version="0.0.7.0" targetFramework="net452" />
|
<package id="DalSoft.WebApi.HelpPage" version="0.0.7.0" targetFramework="net452" />
|
||||||
<package id="Microsoft.AspNet.Razor" version="3.0.0" targetFramework="net452" />
|
<package id="Microsoft.AspNet.Razor" version="3.0.0" targetFramework="net452" />
|
||||||
<package id="Microsoft.AspNet.WebApi" version="5.0.0" targetFramework="net452" />
|
<package id="Microsoft.AspNet.WebApi" version="5.0.0" targetFramework="net452" />
|
||||||
@ -8,21 +9,22 @@
|
|||||||
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net452" />
|
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net452" />
|
||||||
<package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.3" targetFramework="net452" />
|
<package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.3" targetFramework="net452" />
|
||||||
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.0.0" targetFramework="net452" />
|
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.0.0" targetFramework="net452" />
|
||||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net452" />
|
<package id="Microsoft.Owin" version="3.1.0" targetFramework="net452" />
|
||||||
<package id="Microsoft.Owin.FileSystems" version="3.0.1" targetFramework="net452" />
|
<package id="Microsoft.Owin.FileSystems" version="3.0.1" targetFramework="net452" />
|
||||||
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net452" />
|
<package id="Microsoft.Owin.Host.HttpListener" version="3.0.1" targetFramework="net452" />
|
||||||
<package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net452" />
|
<package id="Microsoft.Owin.Hosting" version="3.0.1" targetFramework="net452" />
|
||||||
<package id="Microsoft.Owin.StaticFiles" version="3.0.1" targetFramework="net452" />
|
<package id="Microsoft.Owin.StaticFiles" version="3.0.1" targetFramework="net452" />
|
||||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
|
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
|
||||||
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
|
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
|
||||||
<package id="Ninject" version="3.2.2.0" targetFramework="net452" />
|
<package id="Ninject" version="3.3.4" targetFramework="net452" />
|
||||||
<package id="Ninject.Extensions.ContextPreservation" version="3.2.0.0" targetFramework="net452" />
|
<package id="Ninject.Extensions.ContextPreservation" version="3.3.1" targetFramework="net452" />
|
||||||
<package id="Ninject.Extensions.NamedScope" version="3.2.0.0" targetFramework="net452" />
|
<package id="Ninject.Extensions.Factory" version="3.3.2" targetFramework="net452" />
|
||||||
<package id="Ninject.Extensions.Xml" version="3.2.0.0" targetFramework="net452" />
|
<package id="Ninject.Extensions.NamedScope" version="3.3.0" targetFramework="net452" />
|
||||||
<package id="Ninject.Web.Common" version="3.2.3.0" targetFramework="net452" />
|
<package id="Ninject.Extensions.Xml" version="3.3.0" targetFramework="net452" />
|
||||||
<package id="Ninject.Web.Common.OwinHost" version="3.2.3.0" targetFramework="net452" />
|
<package id="Ninject.Web.Common" version="3.3.1" targetFramework="net452" />
|
||||||
<package id="Ninject.Web.WebApi" version="3.2.4.0" targetFramework="net452" />
|
<package id="Ninject.Web.Common.OwinHost" version="3.3.1" targetFramework="net452" />
|
||||||
<package id="Ninject.Web.WebApi.OwinHost" version="3.2.4.0" targetFramework="net452" />
|
<package id="Ninject.Web.WebApi" version="3.3.0" targetFramework="net452" />
|
||||||
|
<package id="Ninject.Web.WebApi.OwinHost" version="3.3.0" targetFramework="net452" />
|
||||||
<package id="Owin" version="1.0" targetFramework="net452" />
|
<package id="Owin" version="1.0" targetFramework="net452" />
|
||||||
<package id="RazorEngine" version="3.7.2" targetFramework="net452" />
|
<package id="RazorEngine" version="3.7.2" targetFramework="net452" />
|
||||||
<package id="System.Data.SQLite.Core" version="1.0.104.0" targetFramework="net452" />
|
<package id="System.Data.SQLite.Core" version="1.0.104.0" targetFramework="net452" />
|
||||||
|
|||||||
@ -31,6 +31,18 @@
|
|||||||
<assemblyIdentity name="System.Web.Http.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
<assemblyIdentity name="System.Web.Http.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Ninject" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.3.4.0" newVersion="3.3.4.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Ninject.Web.Common" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.3.1.0" newVersion="3.3.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Ninject.Web.Common.OwinHost" publicKeyToken="c7192dc5380945e7" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.3.1.0" newVersion="3.3.1.0" />
|
||||||
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
Loading…
Reference in New Issue
Block a user