Skip to content

Commit

Permalink
Merge pull request #4 from PyramidTechnologies/develop
Browse files Browse the repository at this point in the history
Refactored namespace and main validator class
Add new command line test app that uses the singleton example
  • Loading branch information
catodd committed Sep 21, 2015
2 parents bdd4975 + 4eeb974 commit e2bce17
Show file tree
Hide file tree
Showing 47 changed files with 598 additions and 218,811 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ Apex7000_BillValidator_Test\obj\*
Apex7000_BillValidator/obj/
Apex7000_BillValidator_Test/bin/
Apex7000_BillValidator_Test/obj/
Apex7000_BillValidator/bin/
API_Test/bin/
API_Test/obj/
Apex7000_BillValidator/bin/
docs/
PyramidNETRS232Installer/bin/
PyramidNETRS232Installer/obj/
packages/
PyramidNETRS232_TestApp_Simple/bin/
PyramidNETRS232_TestApp_Simple/obj/
4 changes: 2 additions & 2 deletions API_Test/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// 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("API_Test")]
[assembly: AssemblyTitle("PyramidNETRS232_Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("API_Test")]
[assembly: AssemblyProduct("PyramidNETRS232_Test")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@
<ProjectGuid>{71DEAB9A-CC67-4BD8-9FEC-C5E59ED2A75F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>API_Test</RootNamespace>
<AssemblyName>API_Test</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<RootNamespace>PyramidNETRS232_Test</RootNamespace>
<AssemblyName>PyramidNETRS232_Test</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -54,9 +55,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Apex7000_BillValidator\Apex7000_BillValidator.csproj">
<ProjectReference Include="..\Apex7000_BillValidator\PyramidNETRS232.csproj">
<Project>{735220bb-d8e8-4e21-80d9-aea6e41b13ed}</Project>
<Name>Apex7000_BillValidator</Name>
<Name>PyramidNETRS232</Name>
</ProjectReference>
</ItemGroup>
<Choose>
Expand Down
4 changes: 2 additions & 2 deletions API_Test/SlaveCodex_Test.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Apex7000_BillValidator;
using PyramidNETRS232;

namespace API_Test
namespace PyramidNETRS232_Test
{
[TestClass]
public class SlaveCodex_Test
Expand Down
20 changes: 8 additions & 12 deletions Apex7000_BillValidator/ApexValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
using System.IO;
using System.Threading;

namespace Apex7000_BillValidator
namespace PyramidNETRS232
{
/// <summary>
/// The main class that does the actual "talking" the acceptor. In the context of documentation,
/// this object what is referred to as the master and the acceptor is the slave device.
/// </summary>
public partial class ApexValidator : IDisposable
public partial class PyramidAcceptor : IDisposable
{

private readonly object mutex = new object();
Expand Down Expand Up @@ -66,10 +66,10 @@ public partial class ApexValidator : IDisposable
#endregion

/// <summary>
/// Creates a new ApexValidator using the specified configuration
/// Creates a new PyramidAcceptor using the specified configuration
/// </summary>
/// <param name="config">Operating RS-232 parameters</param>
public ApexValidator(RS232Config config)
public PyramidAcceptor(RS232Config config)
{
this.config = config;
}
Expand Down Expand Up @@ -369,15 +369,15 @@ private byte[] GenerateNormalMessage()
// Toggle message number (ack #) if last message was okay and not a re-send request.
data[2] = (byte)(0x10 | Ack);

// Get enable mask from client configuration. On next message, the acceptor
// will update itself and not escrow any notes that are disabled in this mask.
data[3] = config.EnableMask;


if(!config.IsEscrowMode)
{

// Not escrow mode, all notes are enabled by default
data[3] = 0x7F;

// Clear escrow mode bit
// Clear escrow mode bit
data[4] = 0x00;

if (NoteIsEscrowed)
Expand All @@ -387,10 +387,6 @@ private byte[] GenerateNormalMessage()
else
{

// Get enable mask from client configuration. On next message, the acceptor
// will update itself and not escrow any notes that are disabled in this mask.
data[3] = config.EnableMask;

// Set escrow mode bit
data[4] = 1 << 4;

Expand Down
4 changes: 2 additions & 2 deletions Apex7000_BillValidator/Commands.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

namespace Apex7000_BillValidator
namespace PyramidNETRS232
{
public partial class ApexValidator
public partial class PyramidAcceptor
{
/// <summary>
/// Issue a stack command to the acceptor. Note that the acceptor must
Expand Down
2 changes: 1 addition & 1 deletion Apex7000_BillValidator/DataContracts.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace Apex7000_BillValidator
namespace PyramidNETRS232
{
/// <summary>
/// The bill acceptor will pass through a series of "States" during bill processing. The acceptor will always
Expand Down
2 changes: 1 addition & 1 deletion Apex7000_BillValidator/DebugBuffer.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using System.Text;

namespace Apex7000_BillValidator
namespace PyramidNETRS232
{
/// <summary>
/// Helper entry for describing serial communication transactions
Expand Down
2 changes: 1 addition & 1 deletion Apex7000_BillValidator/EventArgs.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Apex7000_BillValidator
namespace PyramidNETRS232
{
/// <summary>
/// Properties of a state change event
Expand Down
4 changes: 2 additions & 2 deletions Apex7000_BillValidator/Events.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;

namespace Apex7000_BillValidator
namespace PyramidNETRS232
{
public partial class ApexValidator
public partial class PyramidAcceptor
{
/// <summary>
/// Raised when the acceptor reports any event. Events are transient
Expand Down
2 changes: 1 addition & 1 deletion Apex7000_BillValidator/MasterCodex.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace Apex7000_BillValidator
namespace PyramidNETRS232
{
/// <summary>
/// \internal
Expand Down
2 changes: 1 addition & 1 deletion Apex7000_BillValidator/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

[assembly : InternalsVisibleTo("API_Test")]
[assembly : InternalsVisibleTo("PyramidNETRS232_Test")]
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<ProjectGuid>{735220BB-D8E8-4E21-80D9-AEA6E41B13ED}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Apex7000_BillValidator</RootNamespace>
<AssemblyName>Apex7000_BillValidator</AssemblyName>
<RootNamespace>PyramidNETRS232</RootNamespace>
<AssemblyName>PyramidNETRS232</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
Expand All @@ -33,7 +33,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\Apex7000_BillValidator.XML</DocumentationFile>
<DocumentationFile>bin\Release\PyramidNETRS232.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a, processorArchitecture=MSIL">
Expand Down
8 changes: 3 additions & 5 deletions Apex7000_BillValidator/RS232Config.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Apex7000_BillValidator
namespace PyramidNETRS232
{
/// <summary>
/// Define the operating parameters of your bill acceptor
Expand All @@ -22,10 +22,8 @@ public class RS232Config
/// </summary>
/// <seealso cref="RS232Config.IsEscrowMode"/>
/// <param name="commPort">String port name e.g. COM4</param>
public RS232Config(string commPort)
{
new RS232Config(commPort.ToString(), false);
}
public RS232Config(string commPort) : this(commPort.ToString(), false)
{ }

/// <summary>
/// Create a new configuration to use for the Apex7000 validator class.
Expand Down
2 changes: 1 addition & 1 deletion Apex7000_BillValidator/SlaveCodex.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

namespace Apex7000_BillValidator
namespace PyramidNETRS232
{
/// <summary>
/// Used internally to quickly translate between bytes and the string meaning
Expand Down
2 changes: 1 addition & 1 deletion Apex7000_BillValidator_Test/App.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Application x:Class="Apex7000_BillValidator_Test.App"
<Application x:Class="PyramidNETRS232_TestApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
Expand Down
2 changes: 1 addition & 1 deletion Apex7000_BillValidator_Test/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Windows;

namespace Apex7000_BillValidator_Test
namespace PyramidNETRS232_TestApp
{
/// <summary>
/// Interaction logic for App.xaml
Expand Down
7 changes: 2 additions & 5 deletions Apex7000_BillValidator_Test/BillBank_Sample.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace Apex7000_BillValidator_Test
namespace PyramidNETRS232_TestApp
{
partial class MainWindow : INotifyPropertyChanged
{
Expand Down
Loading

0 comments on commit e2bce17

Please sign in to comment.