├── AuroniaDemoApp
├── obj
│ └── Debug
│ │ ├── AuroniaDemoApp.csproj.CopyComplete
│ │ ├── TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
│ │ ├── TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
│ │ ├── TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
│ │ ├── AuroniaDemoApp.csproj.CoreCompileInputs.cache
│ │ ├── AuroniaDemoApp.exe
│ │ ├── AuroniaDemoApp.pdb
│ │ ├── AuroniaDemoApp.Form1.resources
│ │ ├── DesignTimeResolveAssemblyReferences.cache
│ │ ├── AuroniaDemoApp.csproj.GenerateResource.cache
│ │ ├── AuroniaDemoApp.csprojAssemblyReference.cache
│ │ ├── TempPE
│ │ └── Properties.Resources.Designer.cs.dll
│ │ ├── AuroniaDemoApp.Properties.Resources.resources
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ └── AuroniaDemoApp.csproj.FileListAbsolute.txt
├── Resources
│ └── background.png
├── bin
│ └── Debug
│ │ ├── AuroniaDemoApp.exe
│ │ ├── AuroniaDemoApp.pdb
│ │ ├── Neosmartpen.Net.dll
│ │ ├── Neosmartpen.Net.pdb
│ │ ├── Ionic.Zip.Reduced.dll
│ │ ├── InTheHand.Net.Personal.dll
│ │ ├── Neosmartpen.Net.Protocol.v1.dll
│ │ ├── Neosmartpen.Net.Protocol.v1.pdb
│ │ ├── Neosmartpen.Net.Protocol.v2.dll
│ │ ├── Neosmartpen.Net.Protocol.v2.pdb
│ │ └── AuroniaDemoApp.exe.config
├── App.config
├── Properties
│ ├── Settings.settings
│ ├── Settings.Designer.cs
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Program.cs
├── AuroniaDemoApp.csproj
└── Form1.resx
├── Neosmartpen.Net
├── obj
│ └── Debug
│ │ ├── Neosmartpen.Net.csproj.CopyComplete
│ │ ├── Neosmartpen.Net.csproj.CoreCompileInputs.cache
│ │ ├── Neosmartpen.Net.dll
│ │ ├── Neosmartpen.Net.pdb
│ │ ├── Neosmartpen.Net.csprojAssemblyReference.cache
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ └── Neosmartpen.Net.csproj.FileListAbsolute.txt
├── packages.config
├── bin
│ └── Debug
│ │ ├── Neosmartpen.Net.dll
│ │ ├── Neosmartpen.Net.pdb
│ │ └── InTheHand.Net.Personal.dll
├── Neosmartpen
│ └── Net
│ │ ├── IProtocolParser.cs
│ │ ├── IPacket.cs
│ │ ├── IPenComm.cs
│ │ ├── OfflineDataStructure.cs
│ │ ├── Support
│ │ ├── ByteConverter.cs
│ │ ├── Time.cs
│ │ ├── PressureFilter.cs
│ │ ├── ByteUtil.cs
│ │ └── Renderer.cs
│ │ ├── Stroke.cs
│ │ ├── Chunk.cs
│ │ ├── Packet.cs
│ │ ├── PenComm.cs
│ │ ├── Filter
│ │ └── FilterForPaper.cs
│ │ ├── Dot.cs
│ │ └── Bluetooth
│ │ └── BluetoothAdapter.cs
├── Properties
│ └── AssemblyInfo.cs
└── Neosmartpen.Net.csproj
├── Neosmartpen.Net.Protocol.v1
├── obj
│ └── Debug
│ │ ├── Neosmartpen.Net.Protocol.v1.csproj.CopyComplete
│ │ ├── Neosmartpen.Net.Protocol.v1.csproj.CoreCompileInputs.cache
│ │ ├── Neosmartpen.Net.Protocol.v1.dll
│ │ ├── Neosmartpen.Net.Protocol.v1.pdb
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ ├── Neosmartpen.Net.Protocol.v1.csprojAssemblyReference.cache
│ │ └── Neosmartpen.Net.Protocol.v1.csproj.FileListAbsolute.txt
├── packages.config
├── bin
│ └── Debug
│ │ ├── Ionic.Zip.Reduced.dll
│ │ ├── Neosmartpen.Net.dll
│ │ ├── Neosmartpen.Net.pdb
│ │ ├── InTheHand.Net.Personal.dll
│ │ ├── Neosmartpen.Net.Protocol.v1.dll
│ │ └── Neosmartpen.Net.Protocol.v1.pdb
├── Properties
│ └── AssemblyInfo.cs
├── Neosmartpen
│ └── Net
│ │ └── Protocol
│ │ └── v1
│ │ ├── OfflineDataSerializer.cs
│ │ ├── OfflineData.cs
│ │ ├── ProtocolParserV1.cs
│ │ ├── OfflineWorker.cs
│ │ ├── PenCommV1Callbacks.cs
│ │ └── OfflineDataParser.cs
└── Neosmartpen.Net.Protocol.v1.csproj
├── Neosmartpen.Net.Protocol.v2
├── obj
│ └── Debug
│ │ ├── Neosmartpen.Net.Protocol.v2.csproj.CopyComplete
│ │ ├── Neosmartpen.Net.Protocol.v2.csproj.CoreCompileInputs.cache
│ │ ├── Neosmartpen.Net.Protocol.v2.dll
│ │ ├── Neosmartpen.Net.Protocol.v2.pdb
│ │ ├── DesignTimeResolveAssemblyReferencesInput.cache
│ │ ├── Neosmartpen.Net.Protocol.v2.csprojAssemblyReference.cache
│ │ └── Neosmartpen.Net.Protocol.v2.csproj.FileListAbsolute.txt
├── packages.config
├── bin
│ └── Debug
│ │ ├── Ionic.Zip.Reduced.dll
│ │ ├── Neosmartpen.Net.dll
│ │ ├── Neosmartpen.Net.pdb
│ │ ├── InTheHand.Net.Personal.dll
│ │ ├── Neosmartpen.Net.Protocol.v2.dll
│ │ └── Neosmartpen.Net.Protocol.v2.pdb
├── Neosmartpen
│ └── Net
│ │ └── Protocol
│ │ └── v2
│ │ ├── ImageProcessingInfo.cs
│ │ ├── Protocol.cs
│ │ ├── ProtocolParserV2.cs
│ │ └── PenCommV2Callbacks.cs
├── Properties
│ └── AssemblyInfo.cs
└── Neosmartpen.Net.Protocol.v2.csproj
├── Interface.png
├── packages
├── 32feet.NET.3.5.0.0
│ ├── 32feet.NET.3.5.0.0.nupkg
│ └── lib
│ │ ├── net
│ │ └── InTheHand.Net.Personal.dll
│ │ └── net-cf
│ │ └── InTheHand.Net.Personal.dll
└── DotNetZip.Reduced.1.9.1.8
│ ├── DotNetZip.Reduced.1.9.1.8.nupkg
│ └── lib
│ └── net20
│ └── Ionic.Zip.Reduced.dll
├── README.md
└── AuroniaDemoApp.sln
/AuroniaDemoApp/obj/Debug/AuroniaDemoApp.csproj.CopyComplete:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/obj/Debug/Neosmartpen.Net.csproj.CopyComplete:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/AuroniaDemoApp/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/AuroniaDemoApp/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/AuroniaDemoApp/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/obj/Debug/Neosmartpen.Net.Protocol.v1.csproj.CopyComplete:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/obj/Debug/Neosmartpen.Net.Protocol.v2.csproj.CopyComplete:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/AuroniaDemoApp/obj/Debug/AuroniaDemoApp.csproj.CoreCompileInputs.cache:
--------------------------------------------------------------------------------
1 | 35d9dbbad85762dfdf4a3b8caef4d0a88972b6e6
2 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/obj/Debug/Neosmartpen.Net.csproj.CoreCompileInputs.cache:
--------------------------------------------------------------------------------
1 | 3ac2e8e9536bdc68f6dce9440e4bcbc11073e00e
2 |
--------------------------------------------------------------------------------
/Interface.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Interface.png
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/obj/Debug/Neosmartpen.Net.Protocol.v1.csproj.CoreCompileInputs.cache:
--------------------------------------------------------------------------------
1 | 2de5dcafdd589c4d411fd49b4dd12c0a8b7b70be
2 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/obj/Debug/Neosmartpen.Net.Protocol.v2.csproj.CoreCompileInputs.cache:
--------------------------------------------------------------------------------
1 | 7dc51f5961e5ab98ac303824fb7690e44a522acd
2 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/AuroniaDemoApp/Resources/background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/Resources/background.png
--------------------------------------------------------------------------------
/AuroniaDemoApp/bin/Debug/AuroniaDemoApp.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/bin/Debug/AuroniaDemoApp.exe
--------------------------------------------------------------------------------
/AuroniaDemoApp/bin/Debug/AuroniaDemoApp.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/bin/Debug/AuroniaDemoApp.pdb
--------------------------------------------------------------------------------
/AuroniaDemoApp/bin/Debug/Neosmartpen.Net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/bin/Debug/Neosmartpen.Net.dll
--------------------------------------------------------------------------------
/AuroniaDemoApp/bin/Debug/Neosmartpen.Net.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/bin/Debug/Neosmartpen.Net.pdb
--------------------------------------------------------------------------------
/AuroniaDemoApp/obj/Debug/AuroniaDemoApp.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/obj/Debug/AuroniaDemoApp.exe
--------------------------------------------------------------------------------
/AuroniaDemoApp/obj/Debug/AuroniaDemoApp.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/obj/Debug/AuroniaDemoApp.pdb
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/AuroniaDemoApp/bin/Debug/Ionic.Zip.Reduced.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/bin/Debug/Ionic.Zip.Reduced.dll
--------------------------------------------------------------------------------
/Neosmartpen.Net/bin/Debug/Neosmartpen.Net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net/bin/Debug/Neosmartpen.Net.dll
--------------------------------------------------------------------------------
/Neosmartpen.Net/bin/Debug/Neosmartpen.Net.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net/bin/Debug/Neosmartpen.Net.pdb
--------------------------------------------------------------------------------
/Neosmartpen.Net/obj/Debug/Neosmartpen.Net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net/obj/Debug/Neosmartpen.Net.dll
--------------------------------------------------------------------------------
/Neosmartpen.Net/obj/Debug/Neosmartpen.Net.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net/obj/Debug/Neosmartpen.Net.pdb
--------------------------------------------------------------------------------
/AuroniaDemoApp/bin/Debug/InTheHand.Net.Personal.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/bin/Debug/InTheHand.Net.Personal.dll
--------------------------------------------------------------------------------
/Neosmartpen.Net/bin/Debug/InTheHand.Net.Personal.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net/bin/Debug/InTheHand.Net.Personal.dll
--------------------------------------------------------------------------------
/packages/32feet.NET.3.5.0.0/32feet.NET.3.5.0.0.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/packages/32feet.NET.3.5.0.0/32feet.NET.3.5.0.0.nupkg
--------------------------------------------------------------------------------
/AuroniaDemoApp/bin/Debug/Neosmartpen.Net.Protocol.v1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/bin/Debug/Neosmartpen.Net.Protocol.v1.dll
--------------------------------------------------------------------------------
/AuroniaDemoApp/bin/Debug/Neosmartpen.Net.Protocol.v1.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/bin/Debug/Neosmartpen.Net.Protocol.v1.pdb
--------------------------------------------------------------------------------
/AuroniaDemoApp/bin/Debug/Neosmartpen.Net.Protocol.v2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/bin/Debug/Neosmartpen.Net.Protocol.v2.dll
--------------------------------------------------------------------------------
/AuroniaDemoApp/bin/Debug/Neosmartpen.Net.Protocol.v2.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/bin/Debug/Neosmartpen.Net.Protocol.v2.pdb
--------------------------------------------------------------------------------
/AuroniaDemoApp/obj/Debug/AuroniaDemoApp.Form1.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/obj/Debug/AuroniaDemoApp.Form1.resources
--------------------------------------------------------------------------------
/AuroniaDemoApp/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/bin/Debug/Ionic.Zip.Reduced.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v1/bin/Debug/Ionic.Zip.Reduced.dll
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/bin/Debug/Neosmartpen.Net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v1/bin/Debug/Neosmartpen.Net.dll
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/bin/Debug/Neosmartpen.Net.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v1/bin/Debug/Neosmartpen.Net.pdb
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/bin/Debug/Ionic.Zip.Reduced.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v2/bin/Debug/Ionic.Zip.Reduced.dll
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/bin/Debug/Neosmartpen.Net.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v2/bin/Debug/Neosmartpen.Net.dll
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/bin/Debug/Neosmartpen.Net.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v2/bin/Debug/Neosmartpen.Net.pdb
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/bin/Debug/InTheHand.Net.Personal.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v1/bin/Debug/InTheHand.Net.Personal.dll
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/bin/Debug/InTheHand.Net.Personal.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v2/bin/Debug/InTheHand.Net.Personal.dll
--------------------------------------------------------------------------------
/packages/32feet.NET.3.5.0.0/lib/net/InTheHand.Net.Personal.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/packages/32feet.NET.3.5.0.0/lib/net/InTheHand.Net.Personal.dll
--------------------------------------------------------------------------------
/AuroniaDemoApp/obj/Debug/DesignTimeResolveAssemblyReferences.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/obj/Debug/DesignTimeResolveAssemblyReferences.cache
--------------------------------------------------------------------------------
/packages/32feet.NET.3.5.0.0/lib/net-cf/InTheHand.Net.Personal.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/packages/32feet.NET.3.5.0.0/lib/net-cf/InTheHand.Net.Personal.dll
--------------------------------------------------------------------------------
/packages/DotNetZip.Reduced.1.9.1.8/DotNetZip.Reduced.1.9.1.8.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/packages/DotNetZip.Reduced.1.9.1.8/DotNetZip.Reduced.1.9.1.8.nupkg
--------------------------------------------------------------------------------
/packages/DotNetZip.Reduced.1.9.1.8/lib/net20/Ionic.Zip.Reduced.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/packages/DotNetZip.Reduced.1.9.1.8/lib/net20/Ionic.Zip.Reduced.dll
--------------------------------------------------------------------------------
/AuroniaDemoApp/obj/Debug/AuroniaDemoApp.csproj.GenerateResource.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/obj/Debug/AuroniaDemoApp.csproj.GenerateResource.cache
--------------------------------------------------------------------------------
/AuroniaDemoApp/obj/Debug/AuroniaDemoApp.csprojAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/obj/Debug/AuroniaDemoApp.csprojAssemblyReference.cache
--------------------------------------------------------------------------------
/AuroniaDemoApp/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/obj/Debug/TempPE/Properties.Resources.Designer.cs.dll
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/bin/Debug/Neosmartpen.Net.Protocol.v1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v1/bin/Debug/Neosmartpen.Net.Protocol.v1.dll
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/bin/Debug/Neosmartpen.Net.Protocol.v1.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v1/bin/Debug/Neosmartpen.Net.Protocol.v1.pdb
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/obj/Debug/Neosmartpen.Net.Protocol.v1.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v1/obj/Debug/Neosmartpen.Net.Protocol.v1.dll
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/obj/Debug/Neosmartpen.Net.Protocol.v1.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v1/obj/Debug/Neosmartpen.Net.Protocol.v1.pdb
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/bin/Debug/Neosmartpen.Net.Protocol.v2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v2/bin/Debug/Neosmartpen.Net.Protocol.v2.dll
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/bin/Debug/Neosmartpen.Net.Protocol.v2.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v2/bin/Debug/Neosmartpen.Net.Protocol.v2.pdb
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/obj/Debug/Neosmartpen.Net.Protocol.v2.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v2/obj/Debug/Neosmartpen.Net.Protocol.v2.dll
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/obj/Debug/Neosmartpen.Net.Protocol.v2.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v2/obj/Debug/Neosmartpen.Net.Protocol.v2.pdb
--------------------------------------------------------------------------------
/AuroniaDemoApp/bin/Debug/AuroniaDemoApp.exe.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/AuroniaDemoApp/obj/Debug/AuroniaDemoApp.Properties.Resources.resources:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/obj/Debug/AuroniaDemoApp.Properties.Resources.resources
--------------------------------------------------------------------------------
/AuroniaDemoApp/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/AuroniaDemoApp/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/Neosmartpen.Net/obj/Debug/Neosmartpen.Net.csprojAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net/obj/Debug/Neosmartpen.Net.csprojAssemblyReference.cache
--------------------------------------------------------------------------------
/Neosmartpen.Net/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v1/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v2/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/obj/Debug/Neosmartpen.Net.Protocol.v1.csprojAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v1/obj/Debug/Neosmartpen.Net.Protocol.v1.csprojAssemblyReference.cache
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/obj/Debug/Neosmartpen.Net.Protocol.v2.csprojAssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Chinmayrane16/Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110/HEAD/Neosmartpen.Net.Protocol.v2/obj/Debug/Neosmartpen.Net.Protocol.v2.csprojAssemblyReference.cache
--------------------------------------------------------------------------------
/AuroniaDemoApp/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/IProtocolParser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neosmartpen.Net
4 | {
5 | public interface IProtocolParser
6 | {
7 | event EventHandler PacketCreated;
8 |
9 | void Put( byte[] buff, int size );
10 | }
11 |
12 | public class PacketEventArgs : EventArgs
13 | {
14 | public PacketEventArgs( IPacket _packet )
15 | {
16 | Packet = _packet;
17 | }
18 |
19 | public IPacket Packet { get; private set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/AuroniaDemoApp/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 |
7 | namespace AuroniaDemoApp
8 | {
9 | static class Program
10 | {
11 | ///
12 | /// The main entry point for the application.
13 | ///
14 | [STAThread]
15 | static void Main()
16 | {
17 | Application.EnableVisualStyles();
18 | Application.SetCompatibleTextRenderingDefault(false);
19 | Application.Run(new Form1());
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/IPacket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neosmartpen.Net
4 | {
5 | public interface IPacket
6 | {
7 | int Cmd { get; }
8 |
9 | byte GetByte();
10 |
11 | byte[] GetBytes();
12 |
13 | byte[] GetBytes( int size );
14 |
15 | int GetByteToInt();
16 |
17 | byte GetChecksum();
18 |
19 | byte GetChecksum( int length );
20 |
21 | int GetInt();
22 |
23 | long GetLong();
24 |
25 | short GetShort();
26 |
27 | string GetString( int length );
28 |
29 | IPacket Move( int length );
30 |
31 | IPacket Reset();
32 |
33 | int Result { get; }
34 |
35 | string ToString();
36 | bool CheckMoreData();
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/Neosmartpen/Net/Protocol/v2/ImageProcessingInfo.cs:
--------------------------------------------------------------------------------
1 | namespace Neosmartpen.Net.Protocol.v2
2 | {
3 | ///
4 | /// Classes that contain image processing results until coordinates are recognized
5 | ///
6 | public class ImageProcessingInfo
7 | {
8 | ///
9 | /// Number of images received from the image sensor
10 | ///
11 | public int Total { get; set; }
12 |
13 | ///
14 | /// Number of images delivered to the data processor
15 | ///
16 | public int Processed { get; set; }
17 |
18 | ///
19 | /// Number of images processed by the data processor
20 | ///
21 | public int Success { get; set; }
22 |
23 | ///
24 | /// Number of images last used for coordinate recognition
25 | ///
26 | public int Transferred { get; set; }
27 | }
28 | }
--------------------------------------------------------------------------------
/Neosmartpen.Net/obj/Debug/Neosmartpen.Net.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net\bin\Debug\Neosmartpen.Net.dll
2 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net\bin\Debug\Neosmartpen.Net.pdb
3 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net\bin\Debug\InTheHand.Net.Personal.dll
4 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net\bin\Debug\InTheHand.Net.Personal.xml
5 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net\obj\Debug\Neosmartpen.Net.csprojAssemblyReference.cache
6 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net\obj\Debug\Neosmartpen.Net.csproj.CoreCompileInputs.cache
7 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net\obj\Debug\Neosmartpen.Net.csproj.CopyComplete
8 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net\obj\Debug\Neosmartpen.Net.dll
9 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net\obj\Debug\Neosmartpen.Net.pdb
10 |
--------------------------------------------------------------------------------
/AuroniaDemoApp/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace AuroniaDemoApp.Properties
12 | {
13 |
14 |
15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
18 | {
19 |
20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
21 |
22 | public static Settings Default
23 | {
24 | get
25 | {
26 | return defaultInstance;
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
6 | // 어셈블리와 관련된 정보를 수정하려면
7 | // 이 특성 값을 변경하십시오.
8 | [assembly: AssemblyTitle( "Neosmartpen.Net" )]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct( "Neosmartpen.Net" )]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
18 | // 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
19 | // 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
20 | [assembly: ComVisible(false)]
21 |
22 | // 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
23 | [assembly: Guid("ab899bc0-416c-4b99-9daa-cd12b93bf6b5")]
24 |
25 | // 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
26 | //
27 | // 주 버전
28 | // 부 버전
29 | // 빌드 번호
30 | // 수정 버전
31 | //
32 | // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
33 | // 지정되도록 할 수 있습니다.
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("2.1.3.0")]
36 | [assembly: AssemblyFileVersion("2.1.3")]
37 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
6 | // 어셈블리와 관련된 정보를 수정하려면
7 | // 이 특성 값을 변경하십시오.
8 | [assembly: AssemblyTitle( "Neosmartpen.Net.Protocol.v1" )]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct( "Neosmartpen.Net.Protocol.v1" )]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
18 | // 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
19 | // 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
20 | [assembly: ComVisible(false)]
21 |
22 | // 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
23 | [assembly: Guid("a4fdd9f1-346c-4f5c-83a9-8d5906798974")]
24 |
25 | // 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
26 | //
27 | // 주 버전
28 | // 부 버전
29 | // 빌드 번호
30 | // 수정 버전
31 | //
32 | // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
33 | // 지정되도록 할 수 있습니다.
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("2.1.3.0")]
36 | [assembly: AssemblyFileVersion("2.1.3")]
37 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // 어셈블리의 일반 정보는 다음 특성 집합을 통해 제어됩니다.
6 | // 어셈블리와 관련된 정보를 수정하려면
7 | // 이 특성 값을 변경하십시오.
8 | [assembly: AssemblyTitle( "Neosmartpen.Net.Protocol.v2" )]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct( "Neosmartpen.Net.Protocol.v2" )]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
18 | // 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
19 | // 해당 형식에 대해 ComVisible 특성을 true로 설정하십시오.
20 | [assembly: ComVisible(false)]
21 |
22 | // 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
23 | [assembly: Guid("20da154d-f759-4596-a250-1cc0ebc155dc")]
24 |
25 | // 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
26 | //
27 | // 주 버전
28 | // 부 버전
29 | // 빌드 번호
30 | // 수정 버전
31 | //
32 | // 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 버전이 자동으로
33 | // 지정되도록 할 수 있습니다.
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("2.1.3.0")]
36 | [assembly: AssemblyFileVersion("2.1.3")]
37 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/IPenComm.cs:
--------------------------------------------------------------------------------
1 | using System.Net.Sockets;
2 |
3 | namespace Neosmartpen.Net
4 | {
5 | ///
6 | /// Interface of PenCommXXX object
7 | ///
8 | public interface IPenComm
9 | {
10 | IProtocolParser Parser
11 | {
12 | get;
13 | }
14 |
15 | ///
16 | /// Returns the Class of Device of the remote device.
17 | ///
18 | uint DeviceClass
19 | {
20 | get;
21 | }
22 |
23 | ///
24 | /// Gets or sets a name of PenComm object
25 | ///
26 | string Name
27 | {
28 | get;
29 | set;
30 | }
31 |
32 |
33 | ///
34 | /// Gets a version of PenComm object
35 | ///
36 | string Version
37 | {
38 | get;
39 | }
40 |
41 | ///
42 | /// Bind the bluetooth socket with IPenComm class.
43 | ///
44 | /// General socket object that implemented the Berkeley sockets interface.
45 | /// Name of PenComm object
46 | void Bind( Socket socket, string name = null );
47 |
48 | ///
49 | ///
50 | ///
51 | void Clean();
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/OfflineDataStructure.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neosmartpen.Net
4 | {
5 | public class OfflineDataInfo
6 | {
7 | public int Section { protected set; get; }
8 |
9 | public int Owner { protected set; get; }
10 |
11 | public int Note { protected set; get; }
12 |
13 | public int[] Pages { protected set; get; }
14 |
15 | public OfflineDataInfo( int sectionId, int ownerId, int noteId, int[] pages = null )
16 | {
17 | Section = sectionId;
18 | Owner = ownerId;
19 | Note = noteId;
20 | Pages = pages;
21 | }
22 |
23 | public override string ToString()
24 | {
25 | return String.Format( "sec:{0}, owner:{1}, note:{2}", Section, Owner, Note );
26 | }
27 | }
28 |
29 | public class OfflineDataFile
30 | {
31 | public int Section, Owner, Note;
32 | public string FilePath;
33 |
34 | public OfflineDataFile( int sectionId, int ownerId, int noteId, string filePath )
35 | {
36 | Section = sectionId;
37 | Owner = ownerId;
38 | Note = noteId;
39 | FilePath = filePath;
40 | }
41 |
42 | public void Delete()
43 | {
44 | if ( System.IO.Directory.Exists( FilePath ) )
45 | {
46 | System.IO.Directory.Delete( FilePath, true );
47 | }
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/AuroniaDemoApp/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("AuroniaDemoApp")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("AuroniaDemoApp")]
13 | [assembly: AssemblyCopyright("Copyright © 2018")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("6a6be0b5-5ad4-43d7-97e9-c70ef0fe16ad")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/obj/Debug/Neosmartpen.Net.Protocol.v1.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v1\bin\Debug\Neosmartpen.Net.Protocol.v1.dll
2 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v1\bin\Debug\Neosmartpen.Net.Protocol.v1.pdb
3 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v1\bin\Debug\Ionic.Zip.Reduced.dll
4 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v1\bin\Debug\Neosmartpen.Net.dll
5 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v1\bin\Debug\InTheHand.Net.Personal.dll
6 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v1\bin\Debug\Neosmartpen.Net.pdb
7 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v1\bin\Debug\InTheHand.Net.Personal.xml
8 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v1\obj\Debug\Neosmartpen.Net.Protocol.v1.csprojAssemblyReference.cache
9 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v1\obj\Debug\Neosmartpen.Net.Protocol.v1.csproj.CoreCompileInputs.cache
10 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v1\obj\Debug\Neosmartpen.Net.Protocol.v1.csproj.CopyComplete
11 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v1\obj\Debug\Neosmartpen.Net.Protocol.v1.dll
12 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v1\obj\Debug\Neosmartpen.Net.Protocol.v1.pdb
13 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/obj/Debug/Neosmartpen.Net.Protocol.v2.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v2\bin\Debug\Neosmartpen.Net.Protocol.v2.dll
2 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v2\bin\Debug\Neosmartpen.Net.Protocol.v2.pdb
3 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v2\bin\Debug\Ionic.Zip.Reduced.dll
4 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v2\bin\Debug\Neosmartpen.Net.dll
5 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v2\bin\Debug\InTheHand.Net.Personal.dll
6 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v2\bin\Debug\Neosmartpen.Net.pdb
7 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v2\bin\Debug\InTheHand.Net.Personal.xml
8 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v2\obj\Debug\Neosmartpen.Net.Protocol.v2.csprojAssemblyReference.cache
9 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v2\obj\Debug\Neosmartpen.Net.Protocol.v2.csproj.CoreCompileInputs.cache
10 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v2\obj\Debug\Neosmartpen.Net.Protocol.v2.csproj.CopyComplete
11 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v2\obj\Debug\Neosmartpen.Net.Protocol.v2.dll
12 | C:\Users\Chinmay\source\repos\WindowSDK2.0-master\Neosmartpen.Net.Protocol.v2\obj\Debug\Neosmartpen.Net.Protocol.v2.pdb
13 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/Support/ByteConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neosmartpen.Net.Support
4 | {
5 | ///
6 | /// 바이트와 short, int, long 간 변환
7 | ///
8 | public class ByteConverter
9 | {
10 | public static long ByteToLong(byte[] data)
11 | {
12 | //long result = data[0] + ( data[1] << 8 ) + ( data[2] << 16 ) + ( data[3] << 24 )
13 | //+ ( data[4] << 32 ) + ( data[5] << 40 ) + ( data[6] << 48 ) + ( data[7] << 56 );
14 | //return result;
15 |
16 | return BitConverter.ToInt64( data, 0 );
17 | }
18 |
19 | public static int ByteToInt(byte[] data)
20 | {
21 | int result = data[0] + ( data[1] << 8 ) + ( data[2] << 16 ) + ( data[3] << 24 );
22 | return result;
23 | }
24 |
25 | public static int SingleByteToInt(byte data)
26 | {
27 | return (int)( data & 0xFF );
28 | }
29 |
30 | public static short ByteToShort(byte[] data)
31 | {
32 | int result = data[0] + ( data[1] << 8 );
33 | return (short)result;
34 | }
35 |
36 | public static byte[] ShortToByte(short value)
37 | {
38 | byte[] b = BitConverter.GetBytes( value );
39 | return b;
40 | }
41 |
42 | public static byte[] LongToByte( long value )
43 | {
44 | byte[] b = BitConverter.GetBytes( value );
45 | return b;
46 | }
47 |
48 | public static byte[] IntToByte( int value )
49 | {
50 | byte[] b = BitConverter.GetBytes( value );
51 | return b;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/Support/Time.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neosmartpen.Net.Support
4 | {
5 | public class Time
6 | {
7 | ///
8 | /// Time gap form 1970.1.1
9 | ///
10 | /// "long Time gap"
11 | public static long GetUtcTimeStamp()
12 | {
13 | TimeSpan t = ( DateTime.UtcNow - new DateTime( 1970, 1, 1 ) );
14 | long ts = (long)t.TotalSeconds * 1000;
15 | return ts;
16 | }
17 | ///
18 | /// Time offset
19 | ///
20 | ///
21 | public static int GetLocalTimeOffset()
22 | {
23 | TimeSpan offset = TimeZoneInfo.Local.GetUtcOffset( DateTime.UtcNow );
24 | int iofs = (int)offset.TotalSeconds * 1000;
25 | return iofs;
26 | }
27 |
28 | ///
29 | ///
30 | ///
31 | ///
32 | ///
33 | public static DateTime GetDateTime( long timestamp, int offset = 0 )
34 | {
35 | DateTime start = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
36 | //DateTime date = start.AddMilliseconds(timestamp).ToLocalTime();
37 | DateTime date = start.AddMilliseconds( timestamp + offset );
38 | return date;
39 | }
40 |
41 | public static DateTime GetLocalDateTime( long timestamp )
42 | {
43 | DateTime start = new DateTime( 1970, 1, 1, 0, 0, 0, DateTimeKind.Utc );
44 | DateTime date = start.AddMilliseconds(timestamp).ToLocalTime();
45 | return date;
46 | }
47 |
48 | ///
49 | ///
50 | ///
51 | ///
52 | public static long GetTimeGap()
53 | {
54 | // 30day gap
55 | return 2592000000;
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/AuroniaDemoApp/obj/Debug/AuroniaDemoApp.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\bin\Debug\AuroniaDemoApp.exe.config
2 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\bin\Debug\AuroniaDemoApp.exe
3 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\bin\Debug\AuroniaDemoApp.pdb
4 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\obj\Debug\AuroniaDemoApp.csprojAssemblyReference.cache
5 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\obj\Debug\AuroniaDemoApp.Form1.resources
6 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\obj\Debug\AuroniaDemoApp.Properties.Resources.resources
7 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\obj\Debug\AuroniaDemoApp.csproj.GenerateResource.cache
8 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\obj\Debug\AuroniaDemoApp.csproj.CoreCompileInputs.cache
9 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\obj\Debug\AuroniaDemoApp.exe
10 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\obj\Debug\AuroniaDemoApp.pdb
11 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\bin\Debug\Neosmartpen.Net.dll
12 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\bin\Debug\Neosmartpen.Net.Protocol.v1.dll
13 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\bin\Debug\Neosmartpen.Net.Protocol.v2.dll
14 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\bin\Debug\Ionic.Zip.Reduced.dll
15 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\bin\Debug\InTheHand.Net.Personal.dll
16 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\bin\Debug\Neosmartpen.Net.Protocol.v1.pdb
17 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\bin\Debug\Neosmartpen.Net.Protocol.v2.pdb
18 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\bin\Debug\Neosmartpen.Net.pdb
19 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\bin\Debug\InTheHand.Net.Personal.xml
20 | c:\users\chinmay\source\repos\AuroniaDemoApp\AuroniaDemoApp\obj\Debug\AuroniaDemoApp.csproj.CopyComplete
21 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/Neosmartpen/Net/Protocol/v2/Protocol.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neosmartpen.Net.Protocol.v2
4 | {
5 | public class Const
6 | {
7 | public const byte PK_STX = 0xC0;
8 | public const byte PK_ETX = 0xC1;
9 | public const byte PK_DLE = 0x7D;
10 |
11 | public const int PK_POS_CMD = 1;
12 | public const int PK_POS_RESULT = 2;
13 | public const int PK_POS_LENG1 = 2;
14 | public const int PK_POS_LENG2 = 3;
15 |
16 | public const int PK_HEADER_SIZE = 3;
17 | }
18 |
19 | [Flags]
20 | public enum Cmd
21 | {
22 | VERSION_REQUEST = 0x01,
23 | VERSION_RESPONSE = 0x81,
24 |
25 | PASSWORD_REQUEST = 0x02,
26 | PASSWORD_RESPONSE = 0X82,
27 |
28 | PASSWORD_CHANGE_REQUEST = 0X03,
29 | PASSWORD_CHANGE_RESPONSE = 0X83,
30 |
31 | SETTING_INFO_REQUEST = 0X04,
32 | SETTING_INFO_RESPONSE = 0X84,
33 |
34 | LOW_BATTERY_EVENT = 0X61,
35 | SHUTDOWN_EVENT = 0X62,
36 |
37 | SETTING_CHANGE_REQUEST = 0X05,
38 | SETTING_CHANGE_RESPONSE = 0X85,
39 |
40 | ONLINE_DATA_REQUEST = 0X11,
41 | ONLINE_DATA_RESPONSE = 0X91,
42 |
43 | ONLINE_PEN_DATA_REQUEST = 0X12,
44 | ONLINE_PEN_DATA_RESPONSE = 0X92,
45 |
46 | ONLINE_PEN_UPDOWN_EVENT = 0X63,
47 | ONLINE_PAPER_INFO_EVENT = 0X64,
48 | ONLINE_PEN_DOT_EVENT = 0X65,
49 |
50 | OFFLINE_NOTE_LIST_REQUEST = 0X21,
51 | OFFLINE_NOTE_LIST_RESPONSE = 0XA1,
52 |
53 | OFFLINE_PAGE_LIST_REQUEST = 0X22,
54 | OFFLINE_PAGE_LIST_RESPONSE = 0XA2,
55 |
56 | OFFLINE_DATA_REQUEST = 0X23,
57 | OFFLINE_DATA_RESPONSE = 0XA3,
58 | OFFLINE_PACKET_REQUEST = 0X24,
59 | OFFLINE_PACKET_RESPONSE = 0XA4,
60 |
61 | OFFLINE_DATA_DELETE_REQUEST = 0X25,
62 | OFFLINE_DATA_DELETE_RESPONSE = 0XA5,
63 |
64 | FIRMWARE_UPLOAD_REQUEST = 0X31,
65 | FIRMWARE_UPLOAD_RESPONSE = 0XB1,
66 | FIRMWARE_PACKET_REQUEST = 0X32,
67 | FIRMWARE_PACKET_RESPONSE = 0XB2
68 | };
69 | }
70 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Windows-Interface-for-Interacting-with-Neo-SmartPen-NWP-F110
2 | This is a Desktop Interface for Interacting with the IOT device (Neo SmartPen) FWP-F110. You can write any content on NCode Notebooks and receive the strokes on the Desktop screen in real time via Bluetooth. If you are not connected to the Bluetooth the pen saves the written information in its memory and you can view the memory content of the pen anytime. You can even save the images on your Desktop.
3 |
4 | ## About NeoSmartPen
5 | The Neo smartpen is designed to seamlessly integrate the real and digital worlds by transforming what you write on paper - everything from sketches and designs to business meeting notes - to your iOS, Android and Windows devices. It works in tandem with N notebooks, powered by NeoLAB Convergence’s patented Ncode™ technology and the accompanying application, Neo Notes. Find out more at www.neosmartpen.com
6 |
7 | * Tutorial video - https://goo.gl/MQaVwY
8 |
9 | ## NCode Notebooks
10 | There are a wide range of notebooks including pocket sized books, A4-sized paper pads, and stylish journals. Every notebook features NCodeTM technology that allows users to share their notes via email, directly from the page. Neo smartpen requires Ncoded notebooks. Ncodes are printed on every paper of N notebooks and provides signals that enable The Neo smartpen to trace handwriting.
11 |
12 | ## About Ncode™: service development guide
13 | ‘Natural Handwriting’ technology based on Ncode™(Microscopic data patterns containing various types of data) is a handwriting stroke recovery technology that digitizes paper coordinates obtained by optical pen devices such as Neo smartpen. The coordinates then can be used to store handwriting stroke information, analyzed to extract meaning based on user preferences and serve as the basis for many other types of services.
14 |
15 | Click the link below to view a beginners guide to Ncode technology.
16 | << https://github.com/NeoSmartpen/Documentations/blob/master/Ncode™ Service Development Getting Started Guide v1.01.pdf >>
17 |
18 | ## Requirements
19 | * Neo SmartPen
20 | * NCode Notebooks
21 |
22 | Interface supports Pen from Protcol v1 and Protocol v2.
23 |
24 | ## Dependencies
25 | * InTheHand.Net.Personal.dll ( v3.5 )
26 | * Ionic.Zip.Reduced.dll ( v1.9 )
27 |
28 | ## Interface
29 | 
30 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/Stroke.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Neosmartpen.Net
5 | {
6 | ///
7 | /// Represents coordinate of stroke.
8 | /// It consist of Dot's Collection.
9 | ///
10 | public class Stroke : List
11 | {
12 | ///
13 | /// Gets the Section Id of the NCode paper
14 | ///
15 | public int Section { get; private set; }
16 |
17 | ///
18 | /// Gets the Owner Id of the NCode paper
19 | ///
20 | public int Owner { get; private set; }
21 |
22 | ///
23 | /// Gets the Note Id of the NCode paper
24 | ///
25 | public int Note { get; private set; }
26 |
27 | ///
28 | /// Gets the Page Number of the NCode paper
29 | ///
30 | public int Page { get; private set; }
31 |
32 | ///
33 | /// Gets the color of the dot
34 | ///
35 | public int Color { get; private set; }
36 |
37 | ///
38 | /// Gets the timestamp of start point
39 | ///
40 | public long TimeStart { get; private set; }
41 |
42 | ///
43 | /// Gets the timestamp of end point
44 | ///
45 | public long TimeEnd { get; private set; }
46 |
47 | ///
48 | /// A constructor that constructs a Stroke object
49 | ///
50 | /// The Section Id of the NCode paper
51 | /// The Owner Id of the NCode paper
52 | /// The Note Id of the NCode paper
53 | /// The Page Number of the NCode paper
54 | public Stroke( int section, int owner, int note, int page )
55 | {
56 | Section = section;
57 | Owner = owner;
58 | Note = note;
59 | Page = page;
60 | }
61 |
62 | ///
63 | /// Adds a new Dot to the current Stroke object.
64 | ///
65 | /// Dot object
66 | public new void Add( Dot dot )
67 | {
68 | if ( base.Count <= 0 )
69 | {
70 | TimeStart = dot.Timestamp;
71 | Color = dot.Color;
72 | }
73 |
74 | TimeEnd = dot.Timestamp;
75 |
76 | base.Add( dot );
77 | }
78 |
79 | public override string ToString()
80 | {
81 | return String.Format( "Stroke => sectionId : {0}, ownerId : {1}, noteId : {2}, pageId : {3}, timeStart : {4}, timeEnd : {5}", Section, Owner, Note, Page, TimeStart, TimeEnd );
82 | }
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/Support/PressureFilter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neosmartpen.Net.Support
4 | {
5 | public class PressureFilter
6 | {
7 | bool m_bFirst;
8 |
9 | int m_nPrevValue;
10 |
11 | float MAX_PRESSURE_DELTA = 0.1f;
12 |
13 | public readonly int RANGE_MIN=45, RANGE_MAX;
14 |
15 | public readonly double RANGE;
16 |
17 | public PressureFilter(int max)
18 | {
19 | this.m_bFirst = true;
20 |
21 | this.RANGE_MAX = max;
22 |
23 | this.RANGE = (double)( RANGE_MAX - RANGE_MIN );
24 | }
25 |
26 | private int FitRange( int p )
27 | {
28 | if ( p > RANGE_MAX )
29 | {
30 | p = RANGE_MAX;
31 | }
32 | else if ( p < RANGE_MIN )
33 | {
34 | p = RANGE_MIN;
35 | }
36 |
37 | return p;
38 | }
39 |
40 | public int Filter( int nPressure )
41 | {
42 | nPressure = FitRange( nPressure );
43 |
44 | if ( m_bFirst )
45 | {
46 | this.m_bFirst = false;
47 | this.m_nPrevValue = nPressure;
48 |
49 | return nPressure;
50 | }
51 |
52 | float diffRate = 1.0f - (float)nPressure / (float)m_nPrevValue;
53 |
54 | if ( Math.Abs( diffRate ) > MAX_PRESSURE_DELTA )
55 | {
56 | float newRate = ( diffRate < 0 ) ? MAX_PRESSURE_DELTA : -( MAX_PRESSURE_DELTA );
57 | nPressure = (int)( (float)m_nPrevValue * ( 1.0 + newRate ) + 0.5f );
58 | }
59 |
60 | nPressure = FitRange( nPressure );
61 |
62 | this.m_nPrevValue = nPressure;
63 |
64 | return nPressure;
65 | }
66 |
67 | public void Reset()
68 | {
69 | m_bFirst = true;
70 | }
71 |
72 | public double ToRate( int nPressure )
73 | {
74 | double fPressureRate = 0;
75 |
76 | // 필압 강도 측정 (nRangeMin ~ nRangeMax 사이의 값)
77 | if ( nPressure < RANGE_MIN )
78 | {
79 | nPressure = RANGE_MIN;
80 | }
81 |
82 | if( nPressure == 0 )
83 | {
84 | //압력값(퍼센트)를 가져온다.
85 | fPressureRate = 1;
86 | }
87 | else
88 | {
89 | //압력값을 퍼센트로 환산한다.
90 | fPressureRate = (double)( nPressure - RANGE_MIN + 1 ) / RANGE;
91 | }
92 |
93 | if ( fPressureRate > 1.0 )
94 | {
95 | fPressureRate = 1.0;
96 | }
97 | else if ( fPressureRate < 0.01 )
98 | {
99 | fPressureRate = 0.01;
100 | }
101 |
102 | return fPressureRate;
103 | }
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/Neosmartpen/Net/Protocol/v1/OfflineDataSerializer.cs:
--------------------------------------------------------------------------------
1 | using Neosmartpen.Net.Support;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 |
6 | namespace Neosmartpen.Net.Protocol.v1
7 | {
8 | ///
9 | /// 오프라인 데이터 조각을 받아 파일로 완성
10 | ///
11 | public class OfflineDataSerializer : OfflineData
12 | {
13 | public Dictionary chunks;
14 |
15 | private int mPacketCount;
16 |
17 | private bool IsCompressed = false;
18 |
19 | public int sectionId = 0, ownerId = 0, noteId = 0, pageId = 0;
20 |
21 | public static string DEFAULT_FILE_FORMAT = "{0}_{1}_{2}_{3}_{4}.{5}";
22 |
23 | public OfflineDataSerializer( string filepath, int packetCount, bool isCompressed )
24 | {
25 | chunks = new Dictionary();
26 |
27 | string[] arr = filepath.Split( '\\' );
28 |
29 | int sectionOwner = int.Parse( arr[2] );
30 |
31 | byte[] bso = ByteConverter.IntToByte( sectionOwner );
32 |
33 | sectionId = (int)( bso[3] & 0xFF );
34 | ownerId = ByteConverter.ByteToInt( new byte[] { bso[0], bso[1], bso[2], (byte)0x00 } );
35 |
36 | noteId = int.Parse( arr[3] );
37 | pageId = int.Parse( arr[4] );
38 |
39 | mPacketCount = packetCount;
40 | IsCompressed = isCompressed;
41 |
42 | base.SetupFileSystem();
43 | }
44 |
45 | public string MakeFile()
46 | {
47 | lock ( OfflineData.DEFAULT_PATH )
48 | {
49 | ByteUtil buff = new ByteUtil();
50 |
51 | for ( int i=0; i < chunks.Count(); i++ )
52 | {
53 | buff.Put( chunks[i] );
54 | }
55 |
56 | string filename = String.Format( DEFAULT_FILE_FORMAT, sectionId, ownerId, noteId, pageId, Time.GetUtcTimeStamp(), IsCompressed ? "zip" : "pen" );
57 |
58 | string fullpath = OfflineData.DEFAULT_PATH + "\\" + filename;
59 |
60 | if ( ByteToFile( buff.ToArray(), fullpath ) )
61 | {
62 | return fullpath;
63 | }
64 | else
65 | {
66 | return null;
67 | }
68 | }
69 | }
70 |
71 | public void Put( byte[] data, int index )
72 | {
73 | chunks.Add(index, data);
74 | }
75 |
76 | private bool ByteToFile( byte[] bytes, String filepath )
77 | {
78 | try
79 | {
80 | System.IO.FileStream fs = new System.IO.FileStream( filepath, System.IO.FileMode.Create, System.IO.FileAccess.Write );
81 | fs.Write( bytes, 0, bytes.Length );
82 | fs.Close();
83 |
84 | return true;
85 | }
86 | catch ( Exception e )
87 | {
88 | Console.WriteLine( "[OfflineDataSerializer] Exception caught in process: {0}", e.StackTrace );
89 | }
90 |
91 | // error occured, return false
92 | return false;
93 | }
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/Neosmartpen/Net/Protocol/v2/ProtocolParserV2.cs:
--------------------------------------------------------------------------------
1 | using Neosmartpen.Net.Support;
2 | using System;
3 |
4 | namespace Neosmartpen.Net.Protocol.v2
5 | {
6 | ///
7 | /// 읽어드린 바이트에 대한 파서
8 | ///
9 | public class ProtocolParserV2 : IProtocolParser
10 | {
11 | public event EventHandler PacketCreated;
12 |
13 | private ByteUtil mBuffer = null;
14 |
15 | private bool IsEscape = false;
16 |
17 | public void Put( byte[] buff, int size )
18 | {
19 | byte[] test = new byte[size];
20 |
21 | //Array.Copy( buff, 0, test, 0, size );
22 | //System.Console.WriteLine( "Read Buffer : {0}", BitConverter.ToString( test ) );
23 | //System.Console.WriteLine();
24 |
25 | for ( int i = 0; i < size; i++ )
26 | {
27 | if ( buff[i] == Const.PK_STX )
28 | {
29 | // 패킷 시작
30 | mBuffer = new ByteUtil();
31 |
32 | IsEscape = false;
33 | }
34 | else if ( buff[i] == Const.PK_ETX )
35 | {
36 | // 패킷 끝
37 | Packet.Builder builder = new Packet.Builder();
38 |
39 | int cmd = mBuffer.GetByteToInt();
40 |
41 | string cmdstr = Enum.GetName( typeof( Cmd ), cmd );
42 |
43 | int result_size = cmdstr != null && cmdstr.EndsWith( "RESPONSE" ) ? 1 : 0;
44 |
45 | int result = result_size > 0 ? mBuffer.GetByteToInt() : -1;
46 |
47 | int length = mBuffer.GetShort();
48 |
49 | byte[] data = mBuffer.GetBytes();
50 |
51 | //System.Console.WriteLine( "length : {0}, data : {1}", length, data.Length );
52 |
53 | builder.cmd( cmd )
54 | .result( result )
55 | .data( data );
56 |
57 | //System.Console.WriteLine( "Read Packet : {0}", BitConverter.ToString( data ) );
58 | //System.Console.WriteLine();
59 |
60 | mBuffer.Clear();
61 | mBuffer = null;
62 |
63 | PacketCreated( this, new PacketEventArgs( builder.Build() ) );
64 |
65 | IsEscape = false;
66 | }
67 | else if ( buff[i] == Const.PK_DLE )
68 | {
69 | if ( i < size - 1 )
70 | {
71 | mBuffer.Put( (byte)( buff[++i] ^ 0x20 ) );
72 | }
73 | else
74 | {
75 | IsEscape = true;
76 | }
77 | }
78 | else if ( IsEscape )
79 | {
80 | mBuffer.Put( (byte)( buff[i] ^ 0x20 ) );
81 |
82 | IsEscape = false;
83 | }
84 | else
85 | {
86 | mBuffer.Put( buff[i] );
87 | }
88 | }
89 | }
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/AuroniaDemoApp/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace AuroniaDemoApp.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AuroniaDemoApp.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized resource of type System.Drawing.Bitmap.
65 | ///
66 | internal static System.Drawing.Bitmap background1 {
67 | get {
68 | object obj = ResourceManager.GetObject("background1", resourceCulture);
69 | return ((System.Drawing.Bitmap)(obj));
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/Chunk.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Neosmartpen.Net
5 | {
6 | public class Chunk
7 | {
8 | // chunk size is 0.5k
9 | private int mSize = 512;
10 |
11 | private int mRows;
12 |
13 | private List mBuffer;
14 |
15 | private int mFileSize = 0;
16 |
17 | private byte mCheckSum;
18 |
19 | public Chunk( int chunksize )
20 | {
21 | mSize = chunksize;
22 | }
23 |
24 | public Chunk()
25 | {
26 | }
27 |
28 | public static List SplitByteArray( byte[] bytes, int range )
29 | {
30 | List chunk = new List();
31 | List result = new List();
32 |
33 | int i = 1;
34 | int c = 1;
35 |
36 | foreach ( byte b in bytes )
37 | {
38 | // Put the byte into the bytes array
39 | chunk.Add( b );
40 |
41 | // If we match the range, add the byte array and create new one
42 | if ( i == range || c == bytes.Length )
43 | {
44 | // Add as array
45 | result.Add( chunk.ToArray() );
46 |
47 | // Create again
48 | chunk = new List();
49 | i = 0;
50 | }
51 |
52 | c++;
53 | i++;
54 | }
55 |
56 | return result;
57 | }
58 |
59 | public bool Load( string filepath )
60 | {
61 | byte[] datas = null;
62 |
63 | try
64 | {
65 | datas = System.IO.File.ReadAllBytes( filepath );
66 | mCheckSum = CalcChecksum( datas );
67 | }
68 | catch
69 | {
70 | return false;
71 | }
72 |
73 | if ( datas == null )
74 | {
75 | return false;
76 | }
77 |
78 | mFileSize = datas.Length;
79 |
80 | double filesize = datas.Length / mSize;
81 |
82 | mRows = (int)Math.Ceiling( filesize ) + 1;
83 |
84 | mBuffer = SplitByteArray( datas, mSize );
85 |
86 | return true;
87 | }
88 |
89 | public byte[] Get( int number )
90 | {
91 | return mBuffer != null && mBuffer.Count > number ? mBuffer[number] : null;
92 | }
93 |
94 | public int GetFileSize()
95 | {
96 | return mFileSize;
97 | }
98 |
99 | public int GetChunkLength()
100 | {
101 | return mRows;
102 | }
103 |
104 | public int GetChunksize()
105 | {
106 | return mSize;
107 | }
108 |
109 | public byte GetChecksum( int number )
110 | {
111 | return Get( number ) != null ? CalcChecksum( Get( number ) ) : (byte)0x00;
112 | }
113 |
114 | public byte GetTotalChecksum()
115 | {
116 | return mCheckSum;
117 | }
118 |
119 | public static byte CalcChecksum(byte[] bytes)
120 | {
121 | int CheckSum = 0;
122 |
123 | for( int i = 0; i < bytes.Length; i++)
124 | {
125 | CheckSum += (int)(bytes[i] & 0xFF);
126 | }
127 |
128 | return (byte)CheckSum;
129 | }
130 | }
131 | }
132 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/Packet.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neosmartpen.Net
4 | {
5 | public class Packet : IPacket
6 | {
7 | public int Cmd { protected set; get; }
8 |
9 | public int Result { protected set; get; }
10 |
11 | public byte[] Data { protected set; get; }
12 |
13 | private int mIndex = 0;
14 |
15 | public byte GetChecksum( int length )
16 | {
17 | byte[] bytes = new byte[length];
18 |
19 | Array.Copy( Data, mIndex, bytes, 0, length );
20 |
21 | int CheckSum = 0;
22 |
23 | for ( int i = 0; i < bytes.Length; i++ )
24 | {
25 | CheckSum += (int)( bytes[i] & 0xFF );
26 | }
27 |
28 | return (byte)CheckSum;
29 | }
30 |
31 | public byte GetChecksum()
32 | {
33 | return GetChecksum( Data.Length - mIndex );
34 | }
35 |
36 | public bool CheckMoreData()
37 | {
38 | return Data.Length > mIndex;
39 | }
40 |
41 | public int GetInt()
42 | {
43 | return BitConverter.ToInt32( GetBytes(4), 0 );
44 | }
45 |
46 | public short GetShort()
47 | {
48 | return BitConverter.ToInt16( GetBytes(2), 0 );
49 | }
50 |
51 | public long GetLong()
52 | {
53 | return BitConverter.ToInt64( GetBytes(8), 0 );
54 | }
55 |
56 | public int GetByteToInt()
57 | {
58 | return (int)( GetByte() & 0xFF );
59 | }
60 |
61 | public byte[] GetBytes()
62 | {
63 | return GetBytes( Data.Length - mIndex );
64 | }
65 |
66 | public byte[] GetBytes( int size )
67 | {
68 | byte[] result = new byte[size];
69 |
70 | Array.Copy( Data, mIndex, result, 0, size );
71 |
72 | Move( size );
73 |
74 | return result;
75 | }
76 |
77 | public IPacket Move( int size )
78 | {
79 | mIndex += size;
80 | return this;
81 | }
82 |
83 | public IPacket Reset()
84 | {
85 | mIndex = 0;
86 | return this;
87 | }
88 |
89 | public byte GetByte()
90 | {
91 | return GetBytes(1)[0];
92 | }
93 |
94 | public string GetString( int length )
95 | {
96 | return System.Text.Encoding.Default.GetString( GetBytes( length ) ).Trim( '\0' );
97 | }
98 |
99 | public override string ToString()
100 | {
101 | return BitConverter.ToString( Data, 0 );
102 | }
103 |
104 | public class Builder
105 | {
106 | private Packet mPacket;
107 |
108 | public Builder()
109 | {
110 | mPacket = new Packet();
111 | }
112 |
113 | public Builder cmd( int cmd )
114 | {
115 | mPacket.Cmd = cmd;
116 | return this;
117 | }
118 |
119 | public Builder result( int code )
120 | {
121 | mPacket.Result = code;
122 | return this;
123 | }
124 |
125 | public Builder data( byte[] data )
126 | {
127 | mPacket.Data = data;
128 | return this;
129 | }
130 |
131 | public Packet Build()
132 | {
133 | return mPacket;
134 | }
135 | }
136 | }
137 | }
138 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/Neosmartpen/Net/Protocol/v1/OfflineData.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 |
4 | namespace Neosmartpen.Net.Protocol.v1
5 | {
6 | public abstract class OfflineData
7 | {
8 | public static string CURRENT_DIR;
9 | public static string DEFAULT_PATH;
10 | public static string DEFAULT_ERROR_PATH;
11 |
12 | public readonly string EXT_ZIP = ".zip";
13 | public readonly string EXT_ERROR = ".err";
14 | public readonly string EXT_DATA = ".pen";
15 | public readonly string DIR_ROOT = "offline";
16 | public readonly string DIR_ERROR = "err";
17 | public readonly string DIR_TEMP = "temp_";
18 |
19 | // 기본 디렉토리 생성
20 | public void SetDefaultPath( string basepath )
21 | {
22 | basepath = basepath == null || basepath == "" ? Directory.GetCurrentDirectory() : basepath;
23 |
24 | OfflineData.DEFAULT_PATH = basepath + "\\" + DIR_ROOT;
25 | OfflineData.DEFAULT_ERROR_PATH = DEFAULT_PATH + "\\" + DIR_ERROR;
26 | }
27 |
28 | public void SetupFileSystem()
29 | {
30 | if ( !System.IO.Directory.Exists( DEFAULT_PATH ) )
31 | {
32 | System.IO.Directory.CreateDirectory( DEFAULT_PATH );
33 | }
34 |
35 | // 에러 파일 저장 위치 설정
36 | string errorFilePath = DEFAULT_PATH + "\\" + DIR_ERROR;
37 |
38 | if ( !System.IO.Directory.Exists( errorFilePath ) )
39 | {
40 | System.IO.Directory.CreateDirectory( errorFilePath );
41 | }
42 | }
43 |
44 | public string[] GetOfflineFiles()
45 | {
46 | string[] filePaths = Directory.GetFiles( DEFAULT_PATH );
47 | return filePaths;
48 | }
49 |
50 | public string[] GetErrorFiles()
51 | {
52 | string[] filePaths = Directory.GetFiles( DEFAULT_PATH + "\\" + DIR_ERROR );
53 | return filePaths;
54 | }
55 |
56 | public static string GetFileFromFullPath( string fullpath )
57 | {
58 | string[] arr = fullpath.Split( '\\' );
59 |
60 | if ( arr.Length <= 1 )
61 | {
62 | return null;
63 | }
64 |
65 | return arr[arr.Length - 1];
66 | }
67 |
68 | public static string GetFileNameFromFullPath( string fullpath )
69 | {
70 | string[] arr = GetFileFromFullPath( fullpath ).Split( '.' );
71 |
72 | if ( arr.Length < 2 )
73 | {
74 | return null;
75 | }
76 |
77 | return arr[0];
78 | }
79 |
80 | public static string GetFileExtFromFullPath( string fullpath )
81 | {
82 | string[] arr = GetFileFromFullPath( fullpath ).Split( '.' );
83 |
84 | if ( arr.Length < 2 )
85 | {
86 | return null;
87 | }
88 |
89 | string ext = "";
90 |
91 | for ( int i=1; i slist = new List();
102 |
103 | Stroke temp = null;
104 |
105 | foreach ( Dot dot in dots )
106 | {
107 | if ( dot.DotType == DotTypes.PEN_DOWN )
108 | {
109 | temp = new Stroke( dot.Section, dot.Owner, dot.Note, dot.Page );
110 | slist.Add( temp );
111 | }
112 |
113 | temp.Add( dot );
114 | }
115 |
116 | return slist.ToArray();
117 | }
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/AuroniaDemoApp.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27703.2000
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuroniaDemoApp", "AuroniaDemoApp\AuroniaDemoApp.csproj", "{6A6BE0B5-5AD4-43D7-97E9-C70EF0FE16AD}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neosmartpen.Net", "Neosmartpen.Net\Neosmartpen.Net.csproj", "{16297E2B-052F-4A7E-BCB0-9B52C6420F34}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neosmartpen.Net.Protocol.v1", "Neosmartpen.Net.Protocol.v1\Neosmartpen.Net.Protocol.v1.csproj", "{8B255C73-2B9D-438D-BCBC-5CF9C4ECD82B}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Neosmartpen.Net.Protocol.v2", "Neosmartpen.Net.Protocol.v2\Neosmartpen.Net.Protocol.v2.csproj", "{63FE81C9-53F4-4D52-BECE-40EAA0D31998}"
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|Any CPU = Debug|Any CPU
17 | Debug|x64 = Debug|x64
18 | Release|Any CPU = Release|Any CPU
19 | Release|x64 = Release|x64
20 | EndGlobalSection
21 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
22 | {6A6BE0B5-5AD4-43D7-97E9-C70EF0FE16AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {6A6BE0B5-5AD4-43D7-97E9-C70EF0FE16AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {6A6BE0B5-5AD4-43D7-97E9-C70EF0FE16AD}.Debug|x64.ActiveCfg = Debug|Any CPU
25 | {6A6BE0B5-5AD4-43D7-97E9-C70EF0FE16AD}.Debug|x64.Build.0 = Debug|Any CPU
26 | {6A6BE0B5-5AD4-43D7-97E9-C70EF0FE16AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
27 | {6A6BE0B5-5AD4-43D7-97E9-C70EF0FE16AD}.Release|Any CPU.Build.0 = Release|Any CPU
28 | {6A6BE0B5-5AD4-43D7-97E9-C70EF0FE16AD}.Release|x64.ActiveCfg = Release|Any CPU
29 | {6A6BE0B5-5AD4-43D7-97E9-C70EF0FE16AD}.Release|x64.Build.0 = Release|Any CPU
30 | {16297E2B-052F-4A7E-BCB0-9B52C6420F34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31 | {16297E2B-052F-4A7E-BCB0-9B52C6420F34}.Debug|Any CPU.Build.0 = Debug|Any CPU
32 | {16297E2B-052F-4A7E-BCB0-9B52C6420F34}.Debug|x64.ActiveCfg = Debug|x64
33 | {16297E2B-052F-4A7E-BCB0-9B52C6420F34}.Debug|x64.Build.0 = Debug|x64
34 | {16297E2B-052F-4A7E-BCB0-9B52C6420F34}.Release|Any CPU.ActiveCfg = Release|Any CPU
35 | {16297E2B-052F-4A7E-BCB0-9B52C6420F34}.Release|Any CPU.Build.0 = Release|Any CPU
36 | {16297E2B-052F-4A7E-BCB0-9B52C6420F34}.Release|x64.ActiveCfg = Release|x64
37 | {16297E2B-052F-4A7E-BCB0-9B52C6420F34}.Release|x64.Build.0 = Release|x64
38 | {8B255C73-2B9D-438D-BCBC-5CF9C4ECD82B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39 | {8B255C73-2B9D-438D-BCBC-5CF9C4ECD82B}.Debug|Any CPU.Build.0 = Debug|Any CPU
40 | {8B255C73-2B9D-438D-BCBC-5CF9C4ECD82B}.Debug|x64.ActiveCfg = Debug|x64
41 | {8B255C73-2B9D-438D-BCBC-5CF9C4ECD82B}.Debug|x64.Build.0 = Debug|x64
42 | {8B255C73-2B9D-438D-BCBC-5CF9C4ECD82B}.Release|Any CPU.ActiveCfg = Release|Any CPU
43 | {8B255C73-2B9D-438D-BCBC-5CF9C4ECD82B}.Release|Any CPU.Build.0 = Release|Any CPU
44 | {8B255C73-2B9D-438D-BCBC-5CF9C4ECD82B}.Release|x64.ActiveCfg = Release|x64
45 | {8B255C73-2B9D-438D-BCBC-5CF9C4ECD82B}.Release|x64.Build.0 = Release|x64
46 | {63FE81C9-53F4-4D52-BECE-40EAA0D31998}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
47 | {63FE81C9-53F4-4D52-BECE-40EAA0D31998}.Debug|Any CPU.Build.0 = Debug|Any CPU
48 | {63FE81C9-53F4-4D52-BECE-40EAA0D31998}.Debug|x64.ActiveCfg = Debug|x64
49 | {63FE81C9-53F4-4D52-BECE-40EAA0D31998}.Debug|x64.Build.0 = Debug|x64
50 | {63FE81C9-53F4-4D52-BECE-40EAA0D31998}.Release|Any CPU.ActiveCfg = Release|Any CPU
51 | {63FE81C9-53F4-4D52-BECE-40EAA0D31998}.Release|Any CPU.Build.0 = Release|Any CPU
52 | {63FE81C9-53F4-4D52-BECE-40EAA0D31998}.Release|x64.ActiveCfg = Release|x64
53 | {63FE81C9-53F4-4D52-BECE-40EAA0D31998}.Release|x64.Build.0 = Release|x64
54 | EndGlobalSection
55 | GlobalSection(SolutionProperties) = preSolution
56 | HideSolutionNode = FALSE
57 | EndGlobalSection
58 | GlobalSection(ExtensibilityGlobals) = postSolution
59 | SolutionGuid = {8CD6EF92-ED40-4800-9CB8-7AD971948BC8}
60 | EndGlobalSection
61 | EndGlobal
62 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/Neosmartpen.Net.Protocol.v2.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {63FE81C9-53F4-4D52-BECE-40EAA0D31998}
8 | Library
9 | Properties
10 | Neosmartpen.Net
11 | Neosmartpen.Net.Protocol.v2
12 | v4.0
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 | false
25 |
26 |
27 | pdbonly
28 | false
29 | bin\Release\
30 |
31 |
32 | prompt
33 | 4
34 | false
35 | bin\Release\Neosmartpen.Net.Protocol.v2.XML
36 |
37 |
38 | x64
39 | bin\x64\Debug\
40 |
41 |
42 | x64
43 | bin\x64\Release\
44 |
45 |
46 |
47 | ..\packages\DotNetZip.Reduced.1.9.1.8\lib\net20\Ionic.Zip.Reduced.dll
48 | True
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | {16297e2b-052f-4a7e-bcb0-9b52c6420f34}
72 | Neosmartpen.Net
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
87 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/Neosmartpen.Net.Protocol.v1.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {8B255C73-2B9D-438D-BCBC-5CF9C4ECD82B}
8 | Library
9 | Properties
10 | Neosmartpen.Net
11 | Neosmartpen.Net.Protocol.v1
12 | v4.0
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 | false
25 |
26 |
27 | pdbonly
28 | false
29 | bin\Release\
30 |
31 |
32 | prompt
33 | 4
34 | false
35 | bin\Release\Neosmartpen.Net.Protocol.v1.XML
36 |
37 |
38 | x64
39 | bin\x64\Debug\
40 |
41 |
42 | x64
43 | bin\x64\Release\
44 |
45 |
46 |
47 | ..\packages\DotNetZip.Reduced.1.9.1.8\lib\net20\Ionic.Zip.Reduced.dll
48 | True
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | {16297e2b-052f-4a7e-bcb0-9b52c6420f34}
74 | Neosmartpen.Net
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
89 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen.Net.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {16297E2B-052F-4A7E-BCB0-9B52C6420F34}
8 | Library
9 | Properties
10 | Neosmartpen.Net
11 | Neosmartpen.Net
12 | v4.0
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 | false
25 |
26 |
27 | pdbonly
28 | false
29 | bin\Release\
30 |
31 |
32 | prompt
33 | 4
34 | false
35 | bin\Release\Neosmartpen.Net.XML
36 |
37 |
38 | x64
39 | bin\x64\Debug\
40 |
41 |
42 | x64
43 | bin\x64\Release\
44 |
45 |
46 |
47 | ..\packages\32feet.NET.3.5.0.0\lib\net\InTheHand.Net.Personal.dll
48 | True
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
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 |
97 |
--------------------------------------------------------------------------------
/AuroniaDemoApp/AuroniaDemoApp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {6A6BE0B5-5AD4-43D7-97E9-C70EF0FE16AD}
8 | WinExe
9 | AuroniaDemoApp
10 | AuroniaDemoApp
11 | v4.6.1
12 | 512
13 | true
14 |
15 |
16 | AnyCPU
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | AnyCPU
27 | pdbonly
28 | true
29 | bin\Release\
30 | TRACE
31 | prompt
32 | 4
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | Form
50 |
51 |
52 | Form1.cs
53 |
54 |
55 |
56 |
57 |
58 | Form1.cs
59 |
60 |
61 | ResXFileCodeGenerator
62 | Designer
63 | Resources.Designer.cs
64 |
65 |
66 | SettingsSingleFileGenerator
67 | Settings.Designer.cs
68 |
69 |
70 | True
71 | True
72 | Resources.resx
73 |
74 |
75 | True
76 | Settings.settings
77 | True
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | {8b255c73-2b9d-438d-bcbc-5cf9c4ecd82b}
89 | Neosmartpen.Net.Protocol.v1
90 |
91 |
92 | {63fe81c9-53f4-4d52-bece-40eaa0d31998}
93 | Neosmartpen.Net.Protocol.v2
94 |
95 |
96 | {16297e2b-052f-4a7e-bcb0-9b52c6420f34}
97 | Neosmartpen.Net
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/Neosmartpen/Net/Protocol/v1/ProtocolParserV1.cs:
--------------------------------------------------------------------------------
1 | using Neosmartpen.Net.Support;
2 | using System;
3 |
4 | namespace Neosmartpen.Net.Protocol.v1
5 | {
6 | public enum Cmd : byte
7 | {
8 | A_PenOnState = 0x01,
9 | P_PenOnResponse = 0x02,
10 |
11 | P_RTCset = 0x03,
12 | A_RTCsetResponse = 0x04,
13 |
14 | P_HoverOnOff = 0x05,
15 | A_HoverOnOffResponse = 0x06,
16 |
17 | P_ForceCalibrate = 0x07,
18 | A_ForceCalibrateResponse = 0x08,
19 |
20 | P_AutoShutdownTime = 0x09,
21 | A_AutoShutdownTimeResponse = 0x0A,
22 | P_PenSensitivity = 0x2C,
23 | A_PenSensitivityResponse = 0x2D,
24 | P_PenColorSet = 0x28,
25 | A_PenColorSetResponse = 0x29,
26 | P_AutoPowerOnSet = 0x2A,
27 | A_AutoPowerOnResponse = 0x2B,
28 | P_BeepSet = 0x2E,
29 | A_BeepSetResponse = 0x2F,
30 |
31 | P_UsingNoteNotify = 0x0B,
32 | A_UsingNoteNotifyResponse = 0x0C,
33 |
34 | A_PasswordRequest = 0x0D,
35 | P_PasswordResponse = 0x0E,
36 | P_PasswordSet = 0x0F,
37 | A_PasswordSetResponse = 0x10,
38 |
39 | A_DotData = 0x11,
40 | A_DotUpDownData = 0x13,
41 | P_DotUpDownResponse = 0x14,
42 | A_DotIDChange = 0x15,
43 | A_DotUpDownDataNew = 0x16,
44 |
45 | P_PenStatusRequest = 0x21,
46 | A_PenStatusOldResponse = 0x22,
47 | A_PenStatusResponse = 0x25,
48 |
49 | P_OfflineDataRequest = 0x47,
50 | A_OfflineDataInfo = 0x49,
51 | A_OfflineFileInfo = 0x41,
52 | P_OfflineFileInfoResponse = 0x42,
53 | A_OfflineChunk = 0x43,
54 | P_OfflineChunkResponse = 0x44,
55 | A_OfflineResultResponse = 0x48,
56 | P_OfflineNoteList = 0x45,
57 | A_OfflineNoteListResponse = 0x46,
58 | P_OfflineDataRemove = 0x4A,
59 | A_OfflineDataRemoveResponse = 0x4B,
60 |
61 | P_PenSWUpgradeCommand = 0x51,
62 | A_PenSWUpgradeRequest = 0x52,
63 | P_PenSWUpgradeResponse = 0x53,
64 | A_PenSWUpgradeStatus = 0x54
65 | }
66 |
67 | ///
68 | /// 읽어드린 바이트에 대한 파서
69 | ///
70 | public class ProtocolParserV1 : IProtocolParser
71 | {
72 | public event EventHandler PacketCreated;
73 |
74 | private const int PKT_START = 0xC0;
75 | private const int PKT_END = 0xC1;
76 | private const int PKT_EMPTY = 0x00;
77 | private const int PKT_HEADER_LEN = 3;
78 | private const int PKT_LENGTH_POS1 = 1;
79 | private const int PKT_LENGTH_POS2 = 2;
80 | private const int PKT_MAX_LEN = 8200;
81 |
82 | private int counter = 0;
83 | private int dataLength = 0;
84 |
85 | // length
86 | private byte[] lbuffer = new byte[2];
87 |
88 | private static int buffer_size = PKT_MAX_LEN + 1;
89 |
90 | private ByteUtil nbuffer = new ByteUtil(buffer_size);
91 |
92 | private bool isStart = true;
93 |
94 | public void Put(byte[] buff, int size)
95 | {
96 | for (int i = 0; i < size; i++)
97 | {
98 | ParseOneByte(buff[i]);
99 | }
100 | }
101 |
102 | private void ParseOneByte(byte data)
103 | {
104 | int int_data = (int)(data & 0xFF);
105 | //int int_data = data;
106 |
107 | if (int_data == PKT_START && isStart)
108 | {
109 | //System.Console.WriteLine( "ProtocolParser : PKT_START" );
110 | counter = 0;
111 | isStart = false;
112 | }
113 | else if (int_data == PKT_END && counter == dataLength + PKT_HEADER_LEN)
114 | {
115 | Packet.Builder builder = new Packet.Builder();
116 |
117 | // 커맨드를 뽑는다.
118 | int cmd = nbuffer.GetByteToInt();
119 |
120 | // 길이를 뽑는다.
121 | int length = nbuffer.GetShort();
122 |
123 | // 커맨드, 길이를 제외한 나머지 바이트를 컨텐트로 지정
124 | byte[] content = nbuffer.GetBytes();
125 |
126 | PacketCreated(this, new PacketEventArgs(builder.cmd(cmd).data(content).Build()));
127 |
128 | dataLength = 0;
129 | counter = 10;
130 | nbuffer.Clear();
131 | isStart = true;
132 | }
133 | else if (counter > PKT_MAX_LEN)
134 | {
135 | //System.Console.WriteLine( "ProtocolParser : PKT_MAX_LEN" );
136 | counter = 10;
137 | dataLength = 0;
138 | isStart = true;
139 | }
140 | else
141 | {
142 | if (counter == PKT_LENGTH_POS1)
143 | {
144 | lbuffer[0] = data;
145 | }
146 | else if (counter == PKT_LENGTH_POS2)
147 | {
148 | //System.Console.WriteLine( "ProtocolParser : PKT_LENGTH_POS2" );
149 | lbuffer[1] = data;
150 | dataLength = ByteConverter.ByteToShort(lbuffer);
151 | }
152 |
153 | if (!isStart)
154 | {
155 | nbuffer.Put(data);
156 | counter++;
157 | }
158 | }
159 | }
160 | }
161 | }
162 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/Support/ByteUtil.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neosmartpen.Net.Support
4 | {
5 | ///
6 | /// 바이트 버퍼를 대체
7 | ///
8 | public class ByteUtil
9 | {
10 | public const int DEF_LIMIT = 1000, DEF_GROWTH = 1000;
11 |
12 | private int mPosWrite = 0, mPosRead = 0;
13 |
14 | private byte[] mBuffer;
15 |
16 | public delegate byte[] EscapeDelegate( byte input );
17 |
18 | private EscapeDelegate mEscDele;
19 |
20 | public int Size
21 | {
22 | get { return mBuffer != null ? mBuffer.Length : 0; }
23 | }
24 |
25 | public int Max
26 | {
27 | get { return mBuffer != null ? mBuffer.Length - 1 : 0; }
28 | }
29 |
30 | public ByteUtil( int length, EscapeDelegate escape = null )
31 | {
32 | mBuffer = new byte[length];
33 | mEscDele = escape;
34 | }
35 |
36 | public ByteUtil( EscapeDelegate escape = null )
37 | : this( DEF_LIMIT, escape )
38 | {
39 | }
40 |
41 | public ByteUtil( byte[] data ) : this( data.Length, null )
42 | {
43 | //mBuffer = new byte[data.Length];
44 | Array.Copy( data, mBuffer, data.Length );
45 | }
46 |
47 | public void Clear()
48 | {
49 | mPosWrite = 0;
50 | mPosRead = 0;
51 |
52 | Array.Clear( mBuffer, 0, mBuffer.Length );
53 | }
54 |
55 | public ByteUtil Put( byte[] inputs )
56 | {
57 | foreach ( byte b in inputs )
58 | {
59 | Put( b );
60 | }
61 |
62 | return this;
63 | }
64 |
65 | public ByteUtil Put( byte[] inputs, int length )
66 | {
67 | int alength = inputs.Length < length ? inputs.Length : length;
68 |
69 | byte[] result = new byte[length];
70 |
71 | Array.Clear( result, 0, length );
72 | Array.Copy( inputs, 0, result, 0, alength );
73 |
74 | return Put( result );
75 | }
76 |
77 | public ByteUtil Put( byte input, bool escapeIfExist = true )
78 | {
79 | if ( mEscDele != null && escapeIfExist )
80 | {
81 | byte[] escDatas = mEscDele( input );
82 |
83 | foreach ( byte item in escDatas )
84 | {
85 | PutByte( item );
86 | }
87 | }
88 | else
89 | {
90 | PutByte( input );
91 | }
92 |
93 | return this;
94 | }
95 |
96 | private ByteUtil PutByte( byte input )
97 | {
98 | if ( mPosWrite > Max )
99 | {
100 | Expand( DEF_GROWTH );
101 | }
102 |
103 | mBuffer[mPosWrite++] = input;
104 | //AddSingleByte( input );
105 |
106 | return this;
107 | }
108 |
109 | public ByteUtil PutNull( int length )
110 | {
111 | for ( int i=0;i < length; i++ )
112 | {
113 | Put( 0x00 );
114 | }
115 |
116 | return this;
117 | }
118 |
119 | public ByteUtil PutInt(int input)
120 | {
121 | return Put( ByteConverter.IntToByte( input ) );
122 | }
123 |
124 | public ByteUtil PutLong( long input )
125 | {
126 | return Put( ByteConverter.LongToByte( input ) );
127 | }
128 |
129 | public ByteUtil PutShort( short input )
130 | {
131 | return Put( ByteConverter.ShortToByte( input ) );
132 | }
133 |
134 | /*
135 | private void AddSingleByte( byte input )
136 | {
137 | mBuffer[mPosWrite++] = input;
138 | }
139 | */
140 |
141 | private void Expand( int increase )
142 | {
143 | Array.Resize( ref mBuffer, mBuffer.Length + increase );
144 | }
145 |
146 | #region get
147 |
148 | public int GetInt()
149 | {
150 | return BitConverter.ToInt32( GetBytes( 4 ), 0 );
151 | }
152 |
153 | public short GetShort()
154 | {
155 | return BitConverter.ToInt16( GetBytes( 2 ), 0 );
156 | }
157 |
158 | public long GetLong()
159 | {
160 | return BitConverter.ToInt64( GetBytes( 8 ), 0 );
161 | }
162 |
163 | public byte[] GetBytes()
164 | {
165 | return GetBytes( mPosWrite - mPosRead );
166 | }
167 |
168 | public byte[] GetBytes( int size )
169 | {
170 | byte[] result = new byte[size];
171 |
172 | Array.Copy( mBuffer, mPosRead, result, 0, size );
173 |
174 | mPosRead += size;
175 |
176 | return result;
177 | }
178 |
179 | public byte GetByte()
180 | {
181 | return GetBytes( 1 )[0];
182 | }
183 |
184 | public int GetByteToInt()
185 | {
186 | return (int)( GetByte() & 0xFF );
187 | }
188 |
189 | public string GetString( int length )
190 | {
191 | return System.Text.Encoding.Default.GetString( GetBytes( length ) ).Trim( '\0' );
192 | }
193 |
194 | public byte GetChecksum( int length )
195 | {
196 | byte[] bytes = new byte[length];
197 |
198 | Array.Copy( mBuffer, mPosRead, bytes, 0, length );
199 |
200 | int CheckSum = 0;
201 |
202 | for ( int i = 0; i < bytes.Length; i++ )
203 | {
204 | CheckSum += (int)( bytes[i] & 0xFF );
205 | }
206 |
207 | return (byte)CheckSum;
208 | }
209 |
210 | public byte[] ToArray()
211 | {
212 | byte[] result = new byte[mPosWrite];
213 |
214 | Array.Copy( mBuffer, result, mPosWrite);
215 |
216 | return result;
217 | }
218 |
219 | #endregion
220 | }
221 | }
222 |
--------------------------------------------------------------------------------
/AuroniaDemoApp/Form1.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 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/PenComm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Net;
5 | using System.Net.Sockets;
6 | using System.Threading;
7 |
8 | namespace Neosmartpen.Net
9 | {
10 | public abstract class PenComm : IPenComm
11 | {
12 | private Socket mSock { get; set; }
13 |
14 | private Stream mStream { get; set; }
15 |
16 | private Thread mReadThread, mWriteThread;
17 |
18 | private byte[] mReadBuffer = new byte[1024*32];
19 |
20 | private Queue mWriteQueue = new Queue();
21 |
22 | private AutoResetEvent mLockHandleWrite;
23 |
24 | public IProtocolParser Parser
25 | {
26 | get;
27 | protected set;
28 | }
29 |
30 | public abstract uint DeviceClass
31 | {
32 | get;
33 | }
34 |
35 | public abstract string Version
36 | {
37 | get;
38 | }
39 |
40 | public abstract string Name
41 | {
42 | get;
43 | set;
44 | }
45 |
46 | protected internal PenComm( IProtocolParser _parser )
47 | {
48 | Parser = _parser;
49 | }
50 |
51 | public bool Alive
52 | {
53 | get
54 | {
55 | return mSock != null && mStream != null && mSock.Connected && mStream.CanWrite && mStream.CanRead;
56 | }
57 | }
58 |
59 | public void Bind( Socket soc, string name = null )
60 | {
61 | mSock = soc;
62 |
63 | mLockHandleWrite = new AutoResetEvent( false );
64 |
65 | mStream = new NetworkStream( mSock );
66 |
67 | Name = name != null ? name : mSock.RemoteEndPoint.ToString();
68 |
69 | Init();
70 | }
71 |
72 | private bool Init()
73 | {
74 | if ( Alive )
75 | {
76 | StartThread();
77 | return true;
78 | }
79 | else
80 | {
81 | return false;
82 | }
83 | }
84 |
85 | private void StartThread()
86 | {
87 | mReadThread = new Thread( new ThreadStart( ReadRun ) );
88 | mReadThread.Name = "Read Thread";
89 | mReadThread.IsBackground = true;
90 | mReadThread.Start();
91 |
92 | mWriteThread = new Thread( new ThreadStart( WriteRun ) );
93 | mWriteThread.Name = "Write Thread";
94 | mWriteThread.IsBackground = true;
95 | mWriteThread.Start();
96 |
97 | OnConnected();
98 | }
99 |
100 | public void Clean()
101 | {
102 | System.Console.WriteLine( "[PenCommBase] Clean" );
103 |
104 | lock ( mLockHandleWrite )
105 | {
106 | mLockHandleWrite.Set();
107 | }
108 |
109 | try
110 | {
111 | mSock.Close();
112 | }
113 | catch
114 | {
115 | }
116 | }
117 |
118 | protected internal bool Write( byte[] mbyte )
119 | {
120 | if ( !Alive )
121 | {
122 | System.Console.WriteLine( "[PenCommBase] Write Thread is not alive." );
123 | return false;
124 | }
125 |
126 | mWriteQueue.Enqueue( mbyte );
127 |
128 | lock ( mLockHandleWrite )
129 | {
130 | mLockHandleWrite.Set();
131 | }
132 |
133 | return true;
134 | }
135 |
136 | private void WriteRun()
137 | {
138 | System.Console.WriteLine( "[PenCommBase] Write Thread is Started." );
139 |
140 | while ( Alive )
141 | {
142 | while ( mWriteQueue.Count > 0 )
143 | {
144 | byte[] datas = mWriteQueue.Dequeue();
145 |
146 | if ( datas != null && datas.Length > 0 )
147 | {
148 | try
149 | {
150 | mStream.Write( datas, 0, datas.Length );
151 | mStream.Flush();
152 | }
153 | catch ( Exception e )
154 | {
155 | System.Console.WriteLine( e.StackTrace );
156 | break;
157 | }
158 | }
159 | }
160 |
161 | mLockHandleWrite.WaitOne();
162 | }
163 |
164 | System.Console.WriteLine( "[PenCommBase] Write Thread is Terminated" );
165 | }
166 |
167 | private void ReadRun()
168 | {
169 | System.Console.WriteLine( "[PenCommBase] Read Thread is Started" );
170 |
171 | while ( Alive )
172 | {
173 | try
174 | {
175 | int length = mStream.Read( mReadBuffer, 0, mReadBuffer.Length );
176 |
177 | if ( length == 0 )
178 | {
179 | Clean();
180 | break;
181 | }
182 |
183 | Parser.Put( mReadBuffer, length );
184 | }
185 | catch ( Exception e )
186 | {
187 | System.Console.WriteLine( e.StackTrace );
188 | this.Clean();
189 | break;
190 | }
191 | }
192 |
193 | System.Console.WriteLine( "[PenCommBase] Read Thread is Terminated" );
194 |
195 | FinalizeSocket();
196 | OnDisconnected();
197 | }
198 |
199 | private void FinalizeSocket()
200 | {
201 | try
202 | {
203 | mStream.Close();
204 | }
205 | catch
206 | {
207 | }
208 |
209 | try
210 | {
211 | mSock.Close();
212 | }
213 | catch
214 | {
215 | }
216 | }
217 |
218 | protected internal abstract void OnConnected();
219 |
220 | protected internal abstract void OnDisconnected();
221 | }
222 | }
223 |
--------------------------------------------------------------------------------
/AuroniaDemoApp/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
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 |
122 | ..\Resources\background.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
123 |
124 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/Filter/FilterForPaper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neosmartpen.Net.Filter
4 | {
5 | public class FilterForPaper
6 | {
7 | #region Constants
8 | private static readonly int DELTA = 10;
9 | private static readonly int MAX_X = 15070;
10 | private static readonly int MAX_Y = 8480;
11 | private static readonly int MAX_OWNER = 1024;
12 | private static readonly int MAX_NOTE_ID = 16384;
13 | private static readonly int MAX_PAGE_ID = 262143;
14 | #endregion
15 |
16 | #region Variables
17 | private Dot dot1, dot2;
18 | private Dot makeDownDot, makeMoveDot;
19 | private bool secondCheck = true, thirdCheck = true;
20 | #endregion
21 |
22 | #region Delegates
23 | public delegate void FilteredDot(Dot dot, object obj);
24 | private FilteredDot filteredDot;
25 | #endregion
26 |
27 | public FilterForPaper(FilteredDot func)
28 | {
29 | filteredDot = func;
30 | }
31 |
32 | public void Put(Dot dot, object obj)
33 | {
34 | if (!ValidateCode(dot))
35 | {
36 | return;
37 | }
38 |
39 | if (dot.DotType == DotTypes.PEN_DOWN)
40 | {
41 | dot1 = dot;
42 | }
43 | else if (dot.DotType == DotTypes.PEN_MOVE)
44 | {
45 | if ( secondCheck )
46 | {
47 | dot2 = dot;
48 | secondCheck = false;
49 | }
50 | else if ( thirdCheck )
51 | {
52 | if ( ValidateStartDot(dot1, dot2, dot) )
53 | {
54 | filteredDot(dot1, obj);
55 |
56 | if ( ValidateMiddleDot(dot1, dot2, dot))
57 | {
58 | filteredDot(dot2, obj);
59 | dot1 = dot2;
60 | dot2 = dot;
61 | }
62 | else
63 | {
64 | dot2 = dot;
65 | }
66 | }
67 | else
68 | {
69 | dot1 = dot2;
70 | dot2 = dot;
71 | }
72 |
73 | thirdCheck = false;
74 | }
75 | else
76 | {
77 | if (ValidateMiddleDot(dot1, dot2, dot))
78 | {
79 | filteredDot(dot2, obj);
80 | dot1 = dot2;
81 | dot2 = dot;
82 | }
83 | else
84 | {
85 | dot2 = dot;
86 | }
87 | }
88 | }
89 | else if ( dot.DotType == DotTypes.PEN_UP)
90 | {
91 | bool validateStartDot = true;
92 | bool validateMiddleDot = true;
93 | if ( secondCheck)
94 | {
95 | dot2 = dot1;
96 | }
97 | if ( thirdCheck && dot.DotType == DotTypes.PEN_DOWN)
98 | {
99 | if (ValidateStartDot(dot1, dot2, dot))
100 | {
101 | filteredDot(dot1, obj);
102 | }
103 | else
104 | {
105 | validateStartDot = false;
106 | }
107 | }
108 |
109 | if (ValidateMiddleDot(dot1, dot2, dot))
110 | {
111 |
112 | if (!validateStartDot)
113 | {
114 | makeDownDot = new Dot(dot2.Owner, dot2.Section, dot2.Note, dot2.Page, dot2.Timestamp, dot2.X, dot2.Y, dot2.Fx, dot2.Fy, dot2.TiltX, dot2.TiltY, dot2.Twist, dot2.Force, DotTypes.PEN_DOWN, dot2.Color);
115 | filteredDot(makeDownDot, obj);
116 | }
117 |
118 | filteredDot(dot2, obj);
119 | }
120 | else
121 | {
122 | validateMiddleDot = false;
123 | }
124 |
125 | // 마지막 Dot 검증
126 | if (ValidateEndDot(dot1, dot2, dot))
127 | {
128 | if (!validateStartDot && !validateMiddleDot)
129 | {
130 | makeDownDot = new Dot(dot.Owner, dot.Section, dot.Note, dot.Page, dot.Timestamp, dot.X, dot.Y, dot.Fx, dot.Fy, dot.TiltX, dot.TiltY, dot.Twist, dot.Force, DotTypes.PEN_DOWN, dot.Color);
131 | filteredDot(makeDownDot, obj);
132 | }
133 | if (thirdCheck && !validateMiddleDot)
134 | {
135 | makeMoveDot= new Dot(dot.Owner, dot.Section, dot.Note, dot.Page, dot.Timestamp, dot.X, dot.Y, dot.Fx, dot.Fy, dot.TiltX, dot.TiltY, dot.Twist, dot.Force, DotTypes.PEN_MOVE, dot.Color);
136 | filteredDot(makeMoveDot, obj);
137 | }
138 | filteredDot(dot, obj);
139 | }
140 | else
141 | {
142 | dot2.DotType = DotTypes.PEN_UP;
143 | filteredDot(dot2, obj);
144 | }
145 |
146 | // Dot 및 변수 초기화
147 | dot1 = new Dot();
148 | dot2 = new Dot();
149 | secondCheck = true;
150 | thirdCheck = true;
151 | }
152 | }
153 |
154 | private bool ValidateCode(Dot dot)
155 | {
156 | return !(MAX_NOTE_ID < dot.Note || MAX_PAGE_ID < dot.Page);
157 | }
158 |
159 | private bool ValidateStartDot(Dot dot1, Dot dot2, Dot dot3)
160 | {
161 | if (dot1 == null || dot2 == null || dot3 == null)
162 | return false;
163 |
164 | float dot1X = dot1.X + (dot1.Fx * 0.01f);
165 | float dot1Y = dot1.Y + (dot1.Fy * 0.01f);
166 | float dot2X = dot2.X + (dot2.Fx * 0.01f);
167 | float dot2Y = dot2.Y + (dot2.Fy * 0.01f);
168 | float dot3X = dot3.X + (dot3.Fx * 0.01f);
169 | float dot3Y = dot3.Y + (dot3.Fy * 0.01f);
170 |
171 | if (dot1X > MAX_X || dot1X < 1)
172 | return false;
173 | if (dot1Y > MAX_Y || dot1Y < 1)
174 | return false;
175 | if ((dot3X - dot1X) * (dot2X - dot1X) > 0 && Math.Abs(dot3X - dot1X) > DELTA && Math.Abs(dot1X - dot2X) > DELTA)
176 | {
177 | return false;
178 | }
179 | else if ((dot3Y - dot1Y) * (dot2Y - dot1Y) > 0 && Math.Abs(dot3Y - dot1Y) > DELTA && Math.Abs(dot1Y - dot2Y) > DELTA)
180 | {
181 | return false;
182 | }
183 | else
184 | {
185 | return true;
186 | }
187 | }
188 |
189 | private bool ValidateMiddleDot(Dot dot1, Dot dot2, Dot dot3)
190 | {
191 | if (dot1 == null || dot2 == null || dot3 == null)
192 | return false;
193 |
194 | float dot1X = dot1.X + (dot1.Fx * 0.01f);
195 | float dot1Y = dot1.Y + (dot1.Fy * 0.01f);
196 | float dot2X = dot2.X + (dot2.Fx * 0.01f);
197 | float dot2Y = dot2.Y + (dot2.Fy * 0.01f);
198 | float dot3X = dot3.X + (dot3.Fx * 0.01f);
199 | float dot3Y = dot3.Y + (dot3.Fy * 0.01f);
200 |
201 | if (dot2X > MAX_X || dot2X < 1)
202 | return false;
203 | if (dot2Y > MAX_Y || dot2Y < 1)
204 | return false;
205 | if ((dot1X - dot2X) * (dot3X - dot2X) > 0 && Math.Abs(dot1X - dot2X) > DELTA && Math.Abs(dot3X - dot2X) > DELTA)
206 | {
207 | return false;
208 | }
209 | else if ((dot1Y - dot2Y) * (dot3Y - dot2Y) > 0 && Math.Abs(dot1Y - dot2Y) > DELTA && Math.Abs(dot3Y - dot2Y) > DELTA)
210 | {
211 | return false;
212 | }
213 | else
214 | {
215 | return true;
216 | }
217 | }
218 |
219 | private bool ValidateEndDot(Dot dot1, Dot dot2, Dot dot3)
220 | {
221 | if (dot1 == null || dot2 == null || dot3 == null)
222 | return false;
223 |
224 | float dot1X = dot1.X + (dot1.Fx * 0.01f);
225 | float dot1Y = dot1.Y + (dot1.Fy * 0.01f);
226 | float dot2X = dot2.X + (dot2.Fx * 0.01f);
227 | float dot2Y = dot2.Y + (dot2.Fy * 0.01f);
228 | float dot3X = dot3.X + (dot3.Fx * 0.01f);
229 | float dot3Y = dot3.Y + (dot3.Fy * 0.01f);
230 |
231 | if (dot3X > MAX_X || dot3X < 1)
232 | return false;
233 | if (dot3Y > MAX_Y || dot3Y < 1)
234 | return false;
235 | if ((dot3X - dot1X) * (dot3X - dot2X) > 0 && Math.Abs(dot3X - dot1X) > DELTA && Math.Abs(dot3X - dot2X) > DELTA)
236 | {
237 | return false;
238 | }
239 | else if ((dot3Y - dot1Y) * (dot3Y - dot2Y) > 0 && Math.Abs(dot3Y - dot1Y) > DELTA && Math.Abs(dot3Y - dot2Y) > DELTA)
240 | {
241 | return false;
242 | }
243 | else
244 | {
245 | return true;
246 | }
247 | }
248 | }
249 | }
250 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/Neosmartpen/Net/Protocol/v1/OfflineWorker.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading;
5 |
6 | namespace Neosmartpen.Net.Protocol.v1
7 | {
8 | public class OfflineWorker : OfflineData
9 | {
10 | // 처리해야 할 노트 목록
11 | private Queue mOfflineRequestQueue = null;
12 |
13 | private Queue mOfflineProcessQueue = null;
14 |
15 | private AutoResetEvent lockHandleRequest, lockHandleProcess;
16 |
17 | private Thread tOfflineRequestThread, tOfflineProcessThread;
18 |
19 | // 현재 처리중인 노트
20 | private OfflineDataInfo currentNote = null;
21 |
22 | private OfflineWorkResponseHandler mHandler;
23 |
24 | private object noteLock = new object();
25 |
26 | private bool isRun = true;
27 |
28 | public OfflineWorker( OfflineWorkResponseHandler handler )
29 | {
30 | mOfflineRequestQueue = new Queue();
31 | mOfflineProcessQueue = new Queue();
32 |
33 | mHandler = handler;
34 | }
35 |
36 | public void Startup( string basedir = null )
37 | {
38 | base.SetDefaultPath( basedir );
39 |
40 | lockHandleRequest = new AutoResetEvent( false );
41 | lockHandleProcess = new AutoResetEvent( false );
42 |
43 | base.SetupFileSystem();
44 |
45 | tOfflineRequestThread = new Thread( new ThreadStart( RequestNote ) );
46 | tOfflineRequestThread.Name = "tOfflineRequestThread";
47 | tOfflineRequestThread.IsBackground = true;
48 | tOfflineRequestThread.Start();
49 |
50 | tOfflineProcessThread = new Thread( new ThreadStart( ProcessNote ) );
51 | tOfflineProcessThread.Name = "tOfflineProcessThread";
52 | tOfflineProcessThread.IsBackground = true;
53 | tOfflineProcessThread.Start();
54 | }
55 |
56 | public void Dispose()
57 | {
58 | isRun = false;
59 |
60 | lock ( lockHandleRequest )
61 | {
62 | lockHandleRequest.Set();
63 | }
64 |
65 | lock ( lockHandleProcess )
66 | {
67 | lockHandleProcess.Set();
68 | }
69 |
70 | tOfflineRequestThread.Join();
71 | tOfflineProcessThread.Join();
72 | }
73 |
74 | public void Reset()
75 | {
76 | mOfflineRequestQueue.Clear();
77 |
78 | lock ( noteLock )
79 | {
80 | currentNote = null;
81 | }
82 | }
83 |
84 | public void Put( OfflineDataInfo note )
85 | {
86 | Put( new OfflineDataInfo[] { note } );
87 | }
88 |
89 | public void Put( OfflineDataInfo[] notes )
90 | {
91 | bool isEmpty = mOfflineRequestQueue.Count() <= 0;
92 |
93 | foreach ( OfflineDataInfo n in notes )
94 | {
95 | mOfflineRequestQueue.Enqueue( n );
96 | }
97 |
98 | if ( isEmpty )
99 | {
100 | lock ( lockHandleRequest )
101 | {
102 | lockHandleRequest.Set();
103 | }
104 | }
105 | }
106 |
107 | public void onFinishDownload()
108 | {
109 | if ( currentNote == null )
110 | {
111 | return;
112 | }
113 |
114 | if ( currentNote.Section != 4 )
115 | {
116 | mHandler.onRequestRemoveOfflineData( 4, currentNote.Note );
117 | }
118 |
119 | lock ( noteLock )
120 | {
121 | currentNote = null;
122 | }
123 |
124 | mOfflineRequestQueue.Dequeue();
125 |
126 | lock ( lockHandleRequest )
127 | {
128 | lockHandleRequest.Set();
129 | }
130 | }
131 |
132 | public void onCreateFile( int sectionId, int ownerId, int noteId, String filepath )
133 | {
134 | System.Console.WriteLine( "[OfflineWorker] onCreateFile => sectionId : " + sectionId + ", ownerId : " + ownerId + ", noteId : " + noteId + ", filepath : " + filepath );
135 | EnqueueProcessQueue( new OfflineDataFile( sectionId, ownerId, noteId, filepath ) );
136 | }
137 |
138 | private void EnqueueProcessQueue( OfflineDataFile dataFile )
139 | {
140 | System.Console.WriteLine( "[OfflineWorker] enqueueProcessQueue => sectionId : " + dataFile.Section + ", ownerId : " + dataFile.Owner + ", noteId : " + dataFile.Note );
141 |
142 | mOfflineProcessQueue.Enqueue( dataFile );
143 |
144 | lock ( lockHandleProcess )
145 | {
146 | lockHandleProcess.Set();
147 | }
148 | }
149 |
150 | private void RequestNote()
151 | {
152 | while ( isRun )
153 | {
154 | if ( mOfflineRequestQueue.Count() > 0 )
155 | {
156 | lock ( noteLock )
157 | {
158 | currentNote = mOfflineRequestQueue.Peek();
159 |
160 | System.Console.WriteLine( "[OfflineWorker] start download offline note => sectionId : " + currentNote.Section + ", ownerId : " + currentNote.Owner + ", noteId : " + currentNote.Note );
161 |
162 | // 데이터 전송을 요청한다.
163 | mHandler.onRequestDownloadOfflineData( currentNote.Section, currentNote.Owner, currentNote.Note );
164 | }
165 | }
166 |
167 | {
168 | lockHandleRequest.WaitOne();
169 | }
170 | }
171 | }
172 |
173 | private void ProcessNote()
174 | {
175 | while ( isRun )
176 | {
177 | while( mOfflineProcessQueue.Count() > 0 )
178 | {
179 | OfflineDataFile oFile = mOfflineProcessQueue.Dequeue();
180 |
181 | if ( oFile.Section != 4 )
182 | {
183 | ProcessData( oFile );
184 | }
185 | }
186 |
187 | {
188 | lockHandleProcess.WaitOne();
189 | }
190 | }
191 | }
192 |
193 | private Stroke[] DataFileToStroke( OfflineDataFile sfile )
194 | {
195 | if ( sfile == null )
196 | {
197 | return null;
198 | }
199 |
200 | OfflineDataParser parser;
201 |
202 | try
203 | {
204 | if ( !System.IO.File.Exists( sfile.FilePath ) )
205 | {
206 | System.Console.WriteLine( "[OfflineWorker] file not found : " + sfile.FilePath );
207 | return null;
208 | }
209 |
210 | parser = new OfflineDataParser( sfile.FilePath );
211 |
212 | Dot[] dots = parser.Parse();
213 |
214 | parser.Delete();
215 |
216 | if ( dots != null && dots.Length > 0 )
217 | {
218 | return DotArrayToStrokeArray(dots);
219 | }
220 | else
221 | {
222 | System.Console.WriteLine( "[OfflineWorker] parseError" );
223 | }
224 | }
225 | catch ( Exception e )
226 | {
227 | System.Console.WriteLine( "[OfflineWorker] parse file exeption occured. => {0}", e );
228 | }
229 | finally
230 | {
231 | parser = null;
232 | }
233 |
234 | return null;
235 | }
236 |
237 | private void ProcessData( OfflineDataFile currentFile )
238 | {
239 | System.Console.WriteLine( "[OfflineWorker] processData() - begin" );
240 |
241 | // 노트 스트로크
242 | Stroke[] sarr = DataFileToStroke( currentFile );
243 |
244 | if ( sarr == null || sarr.Length <= 0 )
245 | {
246 | return;
247 | }
248 |
249 | mHandler.onReceiveOfflineStrokes(sarr);
250 |
251 | System.Console.WriteLine( "[OfflineWorker] processData() - finish" );
252 | }
253 | }
254 |
255 | public interface OfflineWorkResponseHandler
256 | {
257 | void onReceiveOfflineStrokes( Stroke[] strokes );
258 |
259 | void onRequestDownloadOfflineData( int sectionId, int ownerId, int noteId );
260 |
261 | void onRequestRemoveOfflineData( int sectionId, int ownerId );
262 | }
263 | }
264 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/Dot.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Neosmartpen.Net
4 | {
5 | ///
6 | /// Type of Dot object.
7 | ///
8 | public enum DotTypes
9 | {
10 | PEN_DOWN, PEN_MOVE, PEN_UP, PEN_HOVER
11 | };
12 |
13 | ///
14 | /// Represents coordinate information is detected by sensor of pen.
15 | ///
16 | public class Dot
17 | {
18 | ///
19 | /// The Section Id of the NCode paper
20 | ///
21 | public int Section { get; set; }
22 |
23 | ///
24 | /// The Owner Id of the NCode paper
25 | ///
26 | public int Owner { get; set; }
27 |
28 | ///
29 | /// The Note Id of the NCode paper
30 | ///
31 | public int Note { get; set; }
32 |
33 | ///
34 | /// The Page Number of the NCode paper
35 | ///
36 | public int Page { get; set; }
37 |
38 | ///
39 | /// Gets or sets the x coordinates of NCode cell.
40 | /// ( NCode's cell size is 2.371mm )
41 | ///
42 | public int X { get; set; }
43 |
44 | ///
45 | /// Gets or sets the y coordinates of NCode cell.
46 | /// ( NCode's cell size is 2.371mm )
47 | ///
48 | public int Y { get; set; }
49 |
50 | ///
51 | /// Gets or sets the fractional part of NCode x coordinates. ( maximum value is 100 )
52 | ///
53 | public int Fx { get; set; }
54 |
55 | ///
56 | /// Gets or sets the fractional part of NCode y coordinates. ( maximum value is 100 )
57 | ///
58 | public int Fy { get; set; }
59 |
60 | ///
61 | ///
62 | ///
63 | public int TiltX { get; set; }
64 |
65 | ///
66 | ///
67 | ///
68 | public int TiltY { get; set; }
69 |
70 | ///
71 | ///
72 | ///
73 | public int Twist { get; set; }
74 |
75 | ///
76 | /// Gets or sets the pressure of the dot
77 | ///
78 | public int Force { get; set; }
79 |
80 | ///
81 | /// Gets or sets the color of the dot
82 | ///
83 | public int Color { get; set; }
84 |
85 | ///
86 | /// Gets or sets the timestamp of the dot
87 | ///
88 | public long Timestamp { get; set; }
89 |
90 | ///
91 | /// Gets or sets the type of the dot
92 | ///
93 | public DotTypes DotType { get; set; }
94 |
95 | ///
96 | /// A constructor that constructs a Dot object
97 | ///
98 | public Dot()
99 | {
100 | }
101 |
102 | ///
103 | /// A constructor that constructs a Dot object
104 | ///
105 | /// The Owner Id of the NCode paper
106 | /// The Section Id of the NCode paper
107 | /// The Note Id of the NCode paper
108 | /// The Page Number of the NCode paper
109 | /// the timestamp of the dot
110 | /// the x coordinates of NCode cell
111 | /// the y coordinates of NCode cell
112 | /// the fractional part of NCode x coordinates
113 | /// the fractional part of NCode y coordinates
114 | /// the pressure of the dot
115 | /// the type of the dot
116 | /// the color of the dot
117 | public Dot( int owner, int section, int note, int page, long timestamp, int x, int y, int fx, int fy, int force, DotTypes type, int color )
118 | {
119 | Owner = owner;
120 | Section = section;
121 | Note = note;
122 | Page = page;
123 | X = x;
124 | Y = y;
125 | Fx = fx;
126 | Fy = fy;
127 | Force = force;
128 | Timestamp = timestamp;
129 | DotType = type;
130 | Color = color;
131 | }
132 |
133 | ///
134 | /// A constructor that constructs a Dot object
135 | ///
136 | /// The Owner Id of the NCode paper
137 | /// The Section Id of the NCode paper
138 | /// The Note Id of the NCode paper
139 | /// The Page Number of the NCode paper
140 | /// the timestamp of the dot
141 | /// the x coordinates of NCode cell
142 | /// the y coordinates of NCode cell
143 | /// the fractional part of NCode x coordinates
144 | /// the fractional part of NCode y coordinates
145 | ///
146 | ///
147 | ///
148 | /// the pressure of the dot
149 | /// the type of the dot
150 | /// the color of the dot
151 | public Dot( int owner, int section, int note, int page, long timestamp, int x, int y, int fx, int fy, int tiltX, int tiltY, int twist, int force, DotTypes type, int color )
152 | : this( owner, section, note, page, timestamp, x, y, fx, fy, force,type,color)
153 | {
154 | TiltX = tiltX;
155 | TiltY = tiltY;
156 | Twist = twist;
157 | }
158 |
159 | public Dot Clone()
160 | {
161 | Dot newDot = new Net.Dot();
162 |
163 | newDot.Owner = Owner;
164 | newDot.Section = Section;
165 | newDot.Note = Note;
166 | newDot.Page = Page;
167 | newDot.X = X;
168 | newDot.Y = Y;
169 | newDot.Fx = Fx;
170 | newDot.Fy = Fy;
171 | newDot.Force = Force;
172 | newDot.Timestamp = Timestamp;
173 | newDot.DotType = DotType;
174 | newDot.Color = Color;
175 | newDot.TiltX = TiltX;
176 | newDot.TiltY = TiltY;
177 | newDot.Twist = Twist;
178 |
179 | return newDot;
180 | }
181 |
182 | public override string ToString()
183 | {
184 | return String.Format( "o:{0}, s:{1}, b:{2}, p:{3}, time:{4}, x:{5}, y:{6}, fx:{7}, fy:{8}, force:{9}, type:{10}", Owner, Section, Note, Page, Timestamp, X, Y, Fx, Fy, Force, DotType.ToString() );
185 | }
186 |
187 | public class Builder
188 | {
189 | private Dot mDot;
190 |
191 | public Builder()
192 | {
193 | mDot = new Dot();
194 | }
195 |
196 | public Builder owner( int owner )
197 | {
198 | mDot.Owner = owner;
199 | return this;
200 | }
201 |
202 | public Builder section( int section )
203 | {
204 | mDot.Section = section;
205 | return this;
206 | }
207 |
208 | public Builder note( int note )
209 | {
210 | mDot.Note = note;
211 | return this;
212 | }
213 |
214 | public Builder page( int page )
215 | {
216 | mDot.Page = page;
217 | return this;
218 | }
219 |
220 | public Builder timestamp( long timestamp )
221 | {
222 | mDot.Timestamp = timestamp;
223 | return this;
224 | }
225 |
226 | public Builder coord( int x, int fx, int y, int fy )
227 | {
228 | mDot.X = x;
229 | mDot.Fx = fx;
230 | mDot.Y = y;
231 | mDot.Fy = fy;
232 | return this;
233 | }
234 |
235 | public Builder tilt( int x, int y )
236 | {
237 | mDot.TiltX = x;
238 | mDot.TiltY = y;
239 | return this;
240 | }
241 |
242 | public Builder twist( int twist )
243 | {
244 | mDot.Twist = twist;
245 | return this;
246 | }
247 |
248 | public Builder force( int force )
249 | {
250 | mDot.Force = force;
251 | return this;
252 | }
253 |
254 | public Builder dotType( DotTypes dotType )
255 | {
256 | mDot.DotType = dotType;
257 | return this;
258 | }
259 |
260 | public Builder color( int color )
261 | {
262 | mDot.Color = color;
263 | return this;
264 | }
265 |
266 | public Dot Build()
267 | {
268 | return mDot;
269 | }
270 | }
271 | }
272 | }
273 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/Support/Renderer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | using System.Drawing.Drawing2D;
4 |
5 | namespace Neosmartpen.Net.Support
6 | {
7 | public class Renderer
8 | {
9 |
10 | public static void draw(Bitmap bitmap, Stroke[] stroke, float scalex, float scaley, float offset_x, float offset_y, int width, Color color)
11 | {
12 | foreach (Stroke m in stroke)
13 | {
14 | draw(bitmap, m, scalex, scaley, offset_x, offset_y, width, color);
15 | }
16 | }
17 |
18 | public static void draw(Bitmap bitmap, Stroke stroke, float scalex, float scaley, float offset_x, float offset_y, int width, Color color)
19 | {
20 | RenderStroke m= StroketoRenderStroke(stroke);
21 | draw(bitmap, m, scalex, scaley, offset_x, offset_y, width, color);
22 |
23 | }
24 |
25 |
26 | private static void draw(Bitmap bitmap, RenderStroke neoStroke, float scalex, float scaley, float offset_x, float offset_y, int width, Color color)
27 | {
28 | bool outline = true;
29 | if (neoStroke == null || neoStroke.dotCount == 0)
30 | return;
31 |
32 | ///////////////////////////////////////////////
33 | // 스트로크 랜더링을 위한 준비작업
34 | int ColorA = Math.Min(10*width,(int)(color.A*0.1));
35 |
36 | Pen blackPen = new Pen(Color.FromArgb(ColorA, color), 1);
37 |
38 | SolidBrush mBrush = new SolidBrush(color);
39 |
40 | GraphicsPath graphPath = new GraphicsPath();
41 |
42 | PointF m_ptOrigin = new PointF(offset_x, offset_y);
43 |
44 | Graphics graphics = Graphics.FromImage(bitmap);
45 |
46 | graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
47 |
48 | float scale = Math.Min(scalex, scaley);
49 |
50 | float fMin = 1f;
51 |
52 | ///////////////////////////////////////////////
53 | // 스트로크 그리기
54 |
55 | int count = neoStroke.dotCount;
56 | RenderStroke dotArray = neoStroke;
57 |
58 | if (count <= 2)
59 | {
60 | float[] x, y, p;
61 | x = new float[count + 1];
62 | y = new float[count + 1];
63 | p = new float[count + 1];
64 | for (int i = 0; i < count; i++)
65 | {
66 | x[i] = dotArray.fX[i] * scalex + (float)m_ptOrigin.X;
67 | y[i] = dotArray.fY[i] * scaley + (float)m_ptOrigin.Y;
68 | p[i] = dotArray.fPressureRate[i];
69 | }
70 |
71 | if (count == 1)
72 | {
73 | graphics.DrawEllipse(blackPen, x[0] - 1, y[0] - 1, 2, 2);
74 | }
75 | else if (count == 2)
76 | {
77 | graphics.DrawLine(blackPen, x[0], y[0], x[1], y[1]);
78 | }
79 |
80 | }
81 | else
82 | {
83 | float x0, x1, x2, x3, y0, y1, y2, y3, p0, p1, p2, p3;
84 | float vx01, vy01, vx21, vy21; // unit tangent vectors 0->1 and 1<-2
85 | float norm;
86 | float n_x0, n_y0, n_x2, n_y2; // the normals
87 |
88 |
89 | float thick = width;
90 |
91 | // the first actual point is treated as a midpoint
92 | x0 = dotArray.fX[0] * scalex + (float)m_ptOrigin.X + 0.1f;
93 | y0 = dotArray.fY[0] * scaley + (float)m_ptOrigin.Y;
94 | p0 = Math.Max(fMin, dotArray.fPressureRate[0] * thick);
95 |
96 | x1 = dotArray.fX[1] * scalex + (float)m_ptOrigin.X + 0.1f;
97 | y1 = dotArray.fY[1] * scaley + (float)m_ptOrigin.Y;
98 | p1 = Math.Max(fMin, dotArray.fPressureRate[1] * thick);
99 |
100 | vx01 = x1 - x0;
101 | vy01 = y1 - y0;
102 |
103 | norm = (float)Math.Sqrt(vx01 * vx01 + vy01 * vy01 + 0.0001f) * 2.0f;
104 | vx01 = vx01 / norm * p0;
105 | vy01 = vy01 / norm * p0;
106 | n_x0 = vy01;
107 | n_y0 = -vx01;
108 |
109 | for (int i = 2; i < count - 1; i++)
110 | {
111 |
112 | x3 = dotArray.fX[i] * scalex + (float)m_ptOrigin.X;
113 | y3 = dotArray.fY[i] * scaley + (float)m_ptOrigin.Y;
114 | p3 = Math.Max(fMin, dotArray.fPressureRate[i] * thick);
115 |
116 | x2 = (x1 + x3) / 2.0f;
117 | y2 = (y1 + y3) / 2.0f;
118 | p2 = (p1 + p3) / 2.0f;
119 | vx21 = x1 - x2;
120 | vy21 = y1 - y2;
121 | norm = (float)Math.Sqrt(vx21 * vx21 + vy21 * vy21 + 0.0001f) * 2.0f;
122 | vx21 = vx21 / norm * p2;
123 | vy21 = vy21 / norm * p2;
124 | n_x2 = -vy21;
125 | n_y2 = vx21;
126 |
127 | graphPath.Reset();
128 | //agg_path.MoveTo(x0 + n_x0, y0 + n_y0);
129 |
130 | // Draw a curve : 일단 한 선만 죽 그리면서 간다.
131 | // The + boundary of the stroke
132 |
133 | graphPath.AddBezier(x0 + n_x0, y0 + n_y0, (x1 + n_x0), (y1 + n_y0), (x1 + n_x2), (y1 + n_y2), (x2 + n_x2), (y2 + n_y2));
134 |
135 |
136 | // round out the cap
137 |
138 | //graphPath.AddBezier((x2 + n_x2), (y2 + n_y2), x2 + n_x2 - vx21, y2 + n_y2 - vy21, x2 - n_x2 - vx21, y2 - n_y2 - vy21, x2 - n_x2, y2 - n_y2);
139 |
140 |
141 | // THe - boundary of the stroke
142 |
143 | graphPath.AddBezier(x2 - n_x2, y2 - n_y2, x1 - n_x2, y1 - n_y2, x1 - n_x0, y1 - n_y0, x0 - n_x0, y0 - n_y0);
144 |
145 |
146 | // round out the other cap
147 | if (i == 2)
148 | graphPath.AddBezier(x0 - n_x0, y0 - n_y0, x0 - n_x0 - vx01, y0 - n_y0 - vy01, x0 + n_x0 - vx01, y0 + n_y0 - vy01, x0 + n_x0, y0 + n_y0);
149 |
150 | graphics.FillPath(mBrush, graphPath);
151 | if (outline) graphics.DrawPath(blackPen, graphPath);
152 | //graphics.Render(strockedLineToDraw, color);
153 |
154 | x0 = x2; y0 = y2; p0 = p2;
155 | x1 = x3; y1 = y3; p1 = p3;
156 | vx01 = -vx21; vy01 = -vy21;
157 | n_x0 = n_x2; n_y0 = n_y2;
158 | }
159 |
160 | x2 = dotArray.fX[count - 1] * scalex + (float)m_ptOrigin.X;
161 | y2 = dotArray.fY[count - 1] * scaley + (float)m_ptOrigin.Y;
162 | p2 = Math.Max(fMin, dotArray.fPressureRate[count - 1] * thick);
163 |
164 | vx21 = x1 - x2;
165 | vy21 = y1 - y2;
166 | norm = (float)Math.Sqrt(vx21 * vx21 + vy21 * vy21 + 0.0001f) * 2.0f;
167 | vx21 = vx21 / norm * p2;
168 | vy21 = vy21 / norm * p2;
169 | n_x2 = -vy21;
170 | n_y2 = vx21;
171 |
172 | graphPath.Reset();
173 |
174 | graphPath.AddBezier(x0 + n_x0, y0 + n_y0, x1 + n_x0, y1 + n_y0, x1 + n_x2, y1 + n_y2, x2 + n_x2, y2 + n_y2);
175 |
176 | graphPath.AddBezier(x2 + n_x2, y2 + n_y2, x2 + n_x2 - vx21, y2 + n_y2 - vy21, x2 - n_x2 - vx21, y2 - n_y2 - vy21, x2 - n_x2, y2 - n_y2);
177 |
178 | graphPath.AddBezier(x2 - n_x2, y2 - n_y2, x1 - n_x2, y1 - n_y2, x1 - n_x0, y1 - n_y0, x0 - n_x0, y0 - n_y0);
179 |
180 | //graphPath.AddBezier(x0 - n_x0, y0 - n_y0, x0 - n_x0 - vx01, y0 - n_y0 - vy01, x0 + n_x0 - vx01, y0 + n_y0 - vy01, x0 + n_x0, y0 + n_y0);
181 |
182 | //System.Console.WriteLine("Boundary1 {0},{1},{2},{3},{4},{5},{6},{7}", x0 + n_x0, y0 + n_y0, x1 + n_x0, y1 + n_y0, x1 + n_x2, y1 + n_y2, x2 + n_x2, y2 + n_y2);
183 | //System.Console.WriteLine("Round cap1 {0},{1},{2},{3},{4},{5},{6},{7}", x2 + n_x2, y2 + n_y2, x2 + n_x2 - vx21, y2 + n_y2 - vy21, x2 - n_x2 - vx21, y2 - n_y2 - vy21, x2 - n_x2, y2 - n_y2);
184 | //System.Console.WriteLine("Boundary2 {0},{1},{2},{3},{4},{5},{6},{7}", x2 - n_x2, y2 - n_y2, x1 - n_x2, y1 - n_y2, x1 - n_x0, y1 - n_y0, x0 - n_x0, y0 - n_y0);
185 | //System.Console.WriteLine("cap2 {0},{1},{2},{3},{4},{5},{6},{7}", x0 - n_x0, y0 - n_y0, x0 - n_x0 - vx01, y0 - n_y0 - vy01, x0 + n_x0 - vx01, y0 + n_y0 - vy01, x0 + n_x0, y0 + n_y0);
186 | graphics.FillPath(mBrush, graphPath);
187 | if (outline) graphics.DrawPath(blackPen, graphPath);
188 | // graphics.Render(strockedLineToDraw, color);
189 | mBrush.Dispose();
190 | blackPen.Dispose();
191 | graphics.Dispose();
192 | }
193 | }
194 |
195 |
196 | private static RenderStroke StroketoRenderStroke(Stroke mStroke)
197 | {
198 | RenderStroke ms = new RenderStroke();
199 | ms.createPointArray(mStroke.Count);
200 | int i = 0;
201 | foreach (Dot m in mStroke)
202 | {
203 | ms.fX[i] = m.X + m.Fx * 0.01f;
204 | ms.fY[i] = m.Y + m.Fy * 0.01f;
205 | ms.fPressureRate[i] =(float) m.Force/255;
206 | i++;
207 | }
208 | return ms;
209 | }
210 | }
211 |
212 | class RenderStroke
213 | {
214 | public int dotCount = 0;
215 | public float[] fX;
216 | public float[] fY; // pixel 좌표 값 (inch 값이며, 고정 값이다. 이 값으로 nX, nY가 계산된다)
217 | public float[] fPressureRate; // 필압의 비율이다. (이 값으로 nDotSize가 계산된다)
218 | public byte[] timestampDelta; // 스트로크 시작 시점의 timestamp(64비트)를 기준으로, 추가되는 점들의 시간 차이값 (밀리초 단위)
219 |
220 | public void createPointArray(int count)
221 | {
222 | fX = new float[count];
223 | fY = new float[count];
224 | fPressureRate = new float[count];
225 | timestampDelta = new byte[count];
226 | dotCount = count;
227 | }
228 |
229 | public void clear()
230 | {
231 | fX = null;
232 | fY = null;
233 | fPressureRate = null;
234 | timestampDelta = null;
235 | dotCount = 0;
236 | }
237 |
238 | }
239 |
240 | class RenderParam
241 | {
242 | public float dpi;
243 | public float scale;
244 | public float base_thickness;
245 | public static float PenBallSizeInch = 0.7f; //0.7mm
246 |
247 | public RenderParam()
248 | {
249 | dpi = 72.0f;
250 | scale = 0.01f;//0.01f;
251 | setThickness(2f); //2가 적당함
252 | }
253 |
254 | public RenderParam(float d, float s, float t)
255 | {
256 | dpi = d;
257 | scale = s;
258 | setThickness(t);
259 | }
260 |
261 | public void setThickness(float thickness)
262 | {
263 | base_thickness = PenBallSizeInch * thickness * dpi;
264 | }
265 | }
266 |
267 |
268 | }
269 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/Neosmartpen/Net/Protocol/v1/PenCommV1Callbacks.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace Neosmartpen.Net.Protocol.v1
3 | {
4 | ///
5 | /// The PenCommV1Callbacks interface models a callback used when the the N2 smart pen needs to notify the client side.
6 | /// Please note that the implementation of the PenSignal run on main read thread. so if you want to do heavy work in callback method block, you have to run your code asyncronously.
7 | ///
8 | public interface PenCommV1Callbacks
9 | {
10 | ///
11 | /// Fired when receive a dot successfully, override to handle in your own code.
12 | ///
13 | /// sender refers to the object that invoked the callback method
14 | /// model object of dot
15 | void onReceiveDot( IPenComm sender, Dot dot );
16 |
17 | ///
18 | /// Fired when a connection is made, override to handle in your own code.
19 | ///
20 | /// sender refers to the object that invoked the callback method
21 | /// maximum level of force
22 | /// current version of pen's firmware
23 | void onConnected( IPenComm sender, int maxForce, string firmwareVersion );
24 |
25 | ///
26 | /// Fired when your connection is authenticated.
27 | /// When it fired, you can use all function of pen.
28 | ///
29 | /// sender refers to the object that invoked the callback method
30 | void onPenAuthenticated( IPenComm sender );
31 |
32 | ///
33 | /// Fired when a connection is destroyed, override to handle in your own code.
34 | ///
35 | /// sender refers to the object that invoked the callback method
36 | void onDisconnected( IPenComm sender );
37 |
38 | ///
39 | /// Fired when receive up or down signal from your force sensor of pen, override to handle in your own code.
40 | ///
41 | /// sender refers to the object that invoked the callback method
42 | /// false if N2 detected pressure, otherwise false.
43 | void onUpDown( IPenComm sender, bool isUp );
44 |
45 | ///
46 | /// Fired when receive offline data list in N2 smartpen.
47 | /// When you received this signal, you can request offline data to PenCommV1 by ReqOfflineData method.
48 | ///
49 | /// sender refers to the object that invoked the callback method
50 | /// array of OfflineNote object
51 | void onOfflineDataList( IPenComm sender, OfflineDataInfo[] offlineNotes );
52 |
53 | ///
54 | /// Fired when started downloading, override to handle in your own code.
55 | ///
56 | /// sender refers to the object that invoked the callback method
57 | void onStartOfflineDownload( IPenComm sender );
58 |
59 | ///
60 | /// This method is invoked by the PenCommV1 when it needs to notify the client side about the status of an download operation being performed.
61 | ///
62 | /// sender refers to the object that invoked the callback method
63 | /// amount of total work
64 | /// amount of work done
65 | void onUpdateOfflineDownload( IPenComm sender, int total, int amountDone );
66 |
67 | ///
68 | /// Fired when finished downloading, override to handle in your own code.
69 | ///
70 | /// sender refers to the object that invoked the callback method
71 | /// result of downloading
72 | void onFinishedOfflineDownload( IPenComm sender, bool result );
73 |
74 | ///
75 | /// Fired when received one in all offline data.
76 | /// Array of stroke is consist of single note.
77 | /// This method can be invoked several time as number of offline note.
78 | ///
79 | /// sender refers to the object that invoked the callback method
80 | /// array of stroke object
81 | void onReceiveOfflineStrokes( IPenComm sender, Stroke[] strokes );
82 |
83 | ///
84 | /// Fired when received status of pen, override to handle in your own code.
85 | ///
86 | /// sender refers to the object that invoked the callback method
87 | /// timestamp offset, you should ignore it
88 | /// timestamp, pen knew
89 | /// maximum level of pressure sensor
90 | /// battery status of pen
91 | /// memory status of pen
92 | /// color status of pen
93 | /// the status of the auto power on property that if write the unpowered pen, power on.
94 | /// the status of the acceleration sensor property
95 | /// the status of the hover mode property
96 | /// the status of the beep property
97 | /// the status of the auto shutdown time property
98 | /// the status of pen's sensitivity property
99 | void onReceivedPenStatus( IPenComm sender, int timeoffset, long timetick, int maxForce, int battery, int usedmem, int pencolor, bool autopowerMode, bool accelerationMode, bool hoverMode, bool beep, short autoshutdownTime, short penSensitivity, string modelName );
100 |
101 | ///
102 | /// Fired when pen request a password to client side.
103 | /// When you received this signal, you have to enter password by PenCommV1.InputPassword method.
104 | ///
105 | /// sender refers to the object that invoked the callback method
106 | /// count of enter password
107 | /// if retry count reached reset count, delete all data in pen
108 | void onPenPasswordRequest( IPenComm sender, int retryCount, int resetCount );
109 |
110 | ///
111 | /// Fired when pen response to your request that change password by PenCommV1.InputPassword method.
112 | ///
113 | /// sender refers to the object that invoked the callback method
114 | /// true if your request is successfully applied, otherwise false
115 | void onPenPasswordSetUpResponse( IPenComm sender, bool result );
116 |
117 | ///
118 | /// Fired when pen response to your request that sets the value of the sensitivity property by PenCommV1.ReqSetupPenSensitivity method.
119 | ///
120 | /// sender refers to the object that invoked the callback method
121 | /// true if your request is successfully applied, otherwise false
122 | void onPenSensitivitySetUpResponse( IPenComm sender, bool result );
123 |
124 | ///
125 | /// Fired when pen response to your request that sets the value of the auto shutdown time by PenCommV1.ReqSetupPenAutoShutdownTime method.
126 | ///
127 | /// sender refers to the object that invoked the callback method
128 | /// true if your request is successfully applied, otherwise false
129 | void onPenAutoShutdownTimeSetUpResponse( IPenComm sender, bool result );
130 |
131 | ///
132 | /// Fired when pen response to your request that Sets the status of the beep property by PenCommV1.ReqSetupPenBeep method.
133 | ///
134 | /// sender refers to the object that invoked the callback method
135 | /// true if your request is successfully applied, otherwise false
136 | void onPenBeepSetUpResponse( IPenComm sender, bool result );
137 |
138 | ///
139 | /// Fired when pen response to your request that Sets the status of the auto power on property by PenCommV1.ReqSetupPenBeep method.
140 | ///
141 | /// sender refers to the object that invoked the callback method
142 | /// true if your request is successfully applied, otherwise false
143 | void onPenAutoPowerOnSetUpResponse( IPenComm sender, bool result );
144 |
145 | ///
146 | /// Fired when pen response to your request that sets the status of the hover mode on property by PenCommV1.ReqSetupHoverMode method.
147 | ///
148 | /// sender refers to the object that invoked the callback method
149 | /// true if your request is successfully applied, otherwise false
150 | void onPenHoverSetUpResponse( IPenComm sender, bool result );
151 |
152 | ///
153 | /// Fired when pen response to your request that Sets the color of pen ink by PenCommV1.ReqSetupPenColor method.
154 | ///
155 | /// sender refers to the object that invoked the callback method
156 | /// true if your request is successfully applied, otherwise false
157 | void onPenColorSetUpResponse( IPenComm sender, bool result );
158 |
159 | ///
160 | /// This method is invoked by the PenCommV1 when it needs to notify the client side about the status of an firmware update operation being performed.
161 | ///
162 | /// sender refers to the object that invoked the callback method
163 | /// amount of total work
164 | /// amount of work done
165 | void onReceivedFirmwareUpdateStatus( IPenComm sender, int total, int amountDone );
166 |
167 | ///
168 | /// Fired when finished updating firmware, override to handle in your own code.
169 | ///
170 | /// sender refers to the object that invoked the callback method
171 | /// true if updating is successfully finished, otherwise false
172 | void onReceivedFirmwareUpdateResult( IPenComm sender, bool result );
173 | }
174 | }
175 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v1/Neosmartpen/Net/Protocol/v1/OfflineDataParser.cs:
--------------------------------------------------------------------------------
1 | using Ionic.Zip;
2 | using Neosmartpen.Net.Filter;
3 | using Neosmartpen.Net.Support;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.IO;
7 |
8 | namespace Neosmartpen.Net.Protocol.v1
9 | {
10 | ///
11 | /// 오프라인 데이터 파일을 파싱해서 도트묶음으로 반환
12 | ///
13 | public class OfflineDataParser : OfflineData
14 | {
15 | private byte[] mData, mBody;
16 |
17 | private List mDots = new List();
18 |
19 | private int mOwnerId = 0, mSectionId = 0, mNoteId = 0, mPageId = 0;
20 | private int mLineCount, mDataSize;
21 |
22 | //private byte headerCheckSum;
23 |
24 | private string mTarget = null;
25 |
26 | //private bool mIsCompressed = false;
27 |
28 | private const int LINE_MARK_1 = 0x4c;
29 | private const int LINE_MARK_2 = 0x4e;
30 |
31 | private const int BYTE_LINE_SIZE = 28;
32 | private const int BYTE_DOT_SIZE = 8;
33 | private const int BYTE_HEADER_SIZE = 64;
34 |
35 | private FilterForPaper offlineFilterForPaper;
36 |
37 | public OfflineDataParser( string fullpath )
38 | {
39 | mTarget = fullpath;
40 | offlineFilterForPaper = new FilterForPaper(AddOfflineFilteredDot);
41 | }
42 |
43 | public Dot[] Parse()
44 | {
45 | if ( !mTarget.EndsWith( EXT_DATA ) && !mTarget.EndsWith( EXT_ZIP ) )
46 | {
47 | System.Console.WriteLine( "[OfflineDataParser] this file is not data file" );
48 | return null;
49 | }
50 |
51 | try
52 | {
53 | LoadDataFromFile( mTarget );
54 | ParseHeader();
55 | ParseBody();
56 | }
57 | catch ( Exception e )
58 | {
59 | System.Console.WriteLine( "[OfflineDataParser] parsing exception occured.", e );
60 | }
61 |
62 | if ( mDots == null || mDots.Count <= 0 )
63 | {
64 | return null;
65 | }
66 | else
67 | {
68 | return mDots.ToArray();
69 | }
70 | }
71 |
72 | public void Delete()
73 | {
74 | System.Console.WriteLine( "[OfflineDataParser] delete file : " + mTarget );
75 | System.IO.File.Delete( mTarget );
76 | }
77 |
78 | private void LoadDataFromFile( string fileName )
79 | {
80 | if ( fileName.EndsWith( EXT_ZIP ) )
81 | {
82 | string datafile = Extract( fileName );
83 |
84 | mData = System.IO.File.ReadAllBytes( datafile );
85 |
86 | System.IO.File.Delete( datafile );
87 | }
88 | else
89 | {
90 | mData = System.IO.File.ReadAllBytes( fileName );
91 | }
92 | }
93 |
94 | private string Extract( string file )
95 | {
96 | string newfile = null;
97 |
98 | //System.Console.WriteLine( "[OfflineDataParser] Extract {0}", file );
99 |
100 | string prefix = OfflineData.GetFileNameFromFullPath( file );
101 |
102 | string temp = DEFAULT_PATH + "\\" + DIR_TEMP + prefix;
103 |
104 | try
105 | {
106 | // 임시 폴더 생성
107 | System.IO.Directory.CreateDirectory( temp );
108 |
109 | // 임시 폴더에 압축 해제
110 | ZipFile zipfile = ZipFile.Read( file );
111 | zipfile.ExtractAll( temp );
112 | zipfile.Dispose();
113 |
114 | // 압축 해제된 파일을 기본 폴더로 이동
115 | string[] infiles = Directory.GetFiles( temp );
116 |
117 | if ( infiles == null || infiles.Length != 1 )
118 | {
119 | throw new Exception();
120 | }
121 |
122 | string infile = infiles[0];
123 |
124 | newfile = DEFAULT_PATH + "\\" + prefix + EXT_DATA;
125 |
126 | //System.Console.WriteLine( "[OfflineDataParser] Extract {0} to {1}", infile, newfile );
127 |
128 | System.IO.File.Move( infile, newfile );
129 | }
130 | finally
131 | {
132 | // 임시 폴더 삭제
133 | if ( System.IO.Directory.Exists( temp ) )
134 | {
135 | System.IO.Directory.Delete( temp, true );
136 | }
137 | }
138 |
139 | return newfile;
140 | }
141 |
142 | public static byte[] CopyOfRange( byte[] datas, int start, int size )
143 | {
144 | byte[] result = new byte[size];
145 | Array.Copy( datas, start, result, 0, size );
146 | return result;
147 | }
148 |
149 | private void ParseHeader()
150 | {
151 | byte[] header = CopyOfRange( mData, mData.Length - BYTE_HEADER_SIZE, BYTE_HEADER_SIZE );
152 |
153 | byte[] osbyte = CopyOfRange( header, 6, 4 );
154 |
155 | mSectionId = (int)( osbyte[3] & 0xFF );
156 | mOwnerId = ByteConverter.ByteToInt( new byte[] { osbyte[0], osbyte[1], osbyte[2], (byte)0x00 } );
157 |
158 | mNoteId = ByteConverter.ByteToInt( CopyOfRange( header, 10, 4 ) );
159 | mPageId = ByteConverter.ByteToInt( CopyOfRange( header, 14, 4 ) );
160 |
161 | mLineCount = ByteConverter.ByteToInt( CopyOfRange( header, 22, 4 ) );
162 | mDataSize = ByteConverter.ByteToInt( CopyOfRange( header, 26, 4 ) );
163 | //this.headerCheckSum = header[BYTE_HEADER_SIZE-1];
164 |
165 | mBody = CopyOfRange( mData, 0, mData.Length - BYTE_HEADER_SIZE );
166 |
167 | if ( mBody.Length != mDataSize )
168 | {
169 | throw new Exception( "data size is invalid" );
170 | }
171 |
172 | //System.Console.WriteLine( "[OfflineDataParser] noteId : " + noteId + ", pageId : " + pageId + ", lineCount : " + lineCount + ", fileSize : " + dataSize + "byte" );
173 | }
174 |
175 | public static byte CalcChecksum( byte[] bytes )
176 | {
177 | int CheckSum = 0;
178 |
179 | for ( int i = 0; i < bytes.Length; i++ )
180 | {
181 | CheckSum += (int)( bytes[i] & 0xFF );
182 | }
183 |
184 | return (byte)CheckSum;
185 | }
186 |
187 | private void ParseBody()
188 | {
189 | mDots.Clear();
190 |
191 | long penDownTime = 0, penUpTime = 0, prevTimestamp = 0;
192 |
193 | int dotTotalCount = 0, dotCount = 0;
194 |
195 | byte lineCheckSum = 0;
196 |
197 | int dotStartIndex = 0, dotSize = 0;
198 |
199 | byte[] lineColorBytes = new byte[4];
200 |
201 | int lineColor = 0x000000;
202 |
203 | // 현재 라인의 도트
204 | offlineDots = new List();
205 |
206 | int i = 0;
207 |
208 | while ( i < mBody.Length && mBody.Length > 0 )
209 | {
210 | if ( ByteConverter.SingleByteToInt( mBody[i] ) == LINE_MARK_1 && ByteConverter.SingleByteToInt( mBody[i + 1] ) == LINE_MARK_2 )
211 | {
212 | offlineDots = new List();
213 |
214 | penDownTime = ByteConverter.ByteToLong( CopyOfRange( mBody, i + 2, 8 ) );
215 | penUpTime = ByteConverter.ByteToLong( CopyOfRange( mBody, i + 10, 8 ) );
216 | dotTotalCount = ByteConverter.ByteToInt( CopyOfRange( mBody, i + 18, 4 ) );
217 | lineColorBytes = CopyOfRange( mBody, i + 23, 4 );
218 |
219 | lineColor = ByteConverter.ByteToInt( new byte[] { lineColorBytes[2], lineColorBytes[1], lineColorBytes[0], (byte)0 } );
220 |
221 | //System.Console.WriteLine( "[OfflineDataParser] penDownTime : {0}, penUpTime : {1}, dotTotalCount : {2}, lineColor : {3}", penDownTime, penUpTime, dotTotalCount, lineColor );
222 |
223 | lineCheckSum = mBody[i + 27];
224 |
225 | i += BYTE_LINE_SIZE;
226 |
227 | dotStartIndex = i;
228 | dotSize = 0;
229 | dotCount = 0;
230 | }
231 | else
232 | {
233 | dotCount++;
234 |
235 | // 스트로크 헤더에 정의된 도트갯수보다 넘어가면 LN이 나올때까지 한바이트씩 포인터를 이동한다.
236 | if ( dotCount > dotTotalCount )
237 | {
238 | i++;
239 | continue;
240 | }
241 |
242 | long timeGap = ByteConverter.SingleByteToInt( mBody[i] );
243 |
244 | short x = ByteConverter.ByteToShort( CopyOfRange( mBody, i + 1, 2 ) );
245 | short y = ByteConverter.ByteToShort( CopyOfRange( mBody, i + 3, 2 ) );
246 |
247 | int fx = ByteConverter.SingleByteToInt( mBody[i + 5] );
248 | int fy = ByteConverter.SingleByteToInt( mBody[i + 6] );
249 |
250 | int force = ByteConverter.SingleByteToInt( mBody[i + 7] );
251 |
252 | int color = lineColor;
253 |
254 | bool isPenUp = false;
255 |
256 | long timestamp = -1L;
257 |
258 | DotTypes dotType;
259 |
260 | if ( dotSize == 0 )
261 | {
262 | dotType = DotTypes.PEN_DOWN;
263 | timestamp = penDownTime + timeGap;
264 | prevTimestamp = timestamp;
265 | }
266 | else if ( dotTotalCount > dotCount )
267 | {
268 | dotType = DotTypes.PEN_MOVE;
269 | timestamp = prevTimestamp + timeGap;
270 | prevTimestamp = timestamp;
271 | }
272 | else
273 | {
274 | dotType = DotTypes.PEN_UP;
275 | timestamp = penUpTime;
276 | isPenUp = true;
277 | }
278 |
279 | offlineFilterForPaper.Put(
280 | new Dot.Builder()
281 | .section( mSectionId )
282 | .owner( mOwnerId )
283 | .note( mNoteId )
284 | .page( mPageId )
285 | .coord( x, fx, y, fy )
286 | .force( force )
287 | .color( color )
288 | .timestamp( timestamp )
289 | .dotType( dotType ).Build(), null
290 | );
291 |
292 | dotSize += 8;
293 |
294 | if ( isPenUp )
295 | {
296 | byte dotCalcCs = CalcChecksum( CopyOfRange( mBody, dotStartIndex, dotSize ) );
297 |
298 | if ( dotCalcCs == lineCheckSum )
299 | {
300 | for ( int j = 0; j < offlineDots.Count; j++ )
301 | {
302 | mDots.Add( offlineDots[j] );
303 | }
304 | }
305 | else
306 | {
307 | System.Console.WriteLine( "[OfflineDataParser] invalid CheckSum cs : " + lineCheckSum + ", calc : " + dotCalcCs );
308 | }
309 |
310 | offlineDots = new List();
311 | }
312 |
313 | i += BYTE_DOT_SIZE;
314 | }
315 | }
316 | }
317 |
318 | private List offlineDots;
319 | private void AddOfflineFilteredDot(Dot dot, object obj)
320 | {
321 | offlineDots.Add(dot);
322 | }
323 |
324 | }
325 | }
326 |
--------------------------------------------------------------------------------
/Neosmartpen.Net/Neosmartpen/Net/Bluetooth/BluetoothAdapter.cs:
--------------------------------------------------------------------------------
1 | using InTheHand.Net;
2 | using InTheHand.Net.Bluetooth;
3 | using InTheHand.Net.Sockets;
4 | using Microsoft.Win32;
5 | using System;
6 | using System.Collections.Generic;
7 |
8 | namespace Neosmartpen.Net.Bluetooth
9 | {
10 | ///
11 | /// Class describing the devices discovered.
12 | ///
13 | public class PenDevice
14 | {
15 | ///
16 | /// Gets a name of a device.
17 | ///
18 | public string Name { internal set; get; }
19 |
20 | ///
21 | /// Gets the device identifier.
22 | ///
23 | public string Address { internal set; get; }
24 |
25 | ///
26 | /// Specifies whether the device is authenticated, paired, or bonded. All authenticated devices are remembered.
27 | ///
28 | public bool Authenticated { internal set; get; }
29 |
30 | ///
31 | /// Date and Time this device was last seen by the system.
32 | ///
33 | public DateTime LastSeen { internal set; get; }
34 |
35 | ///
36 | /// Date and Time this device was last used by the system.
37 | ///
38 | public DateTime LastUsed { internal set; get; }
39 |
40 | ///
41 | /// Specifies whether the device is a remembered device. Not all remembered devices are authenticated.
42 | ///
43 | public bool Remembered { internal set; get; }
44 |
45 | ///
46 | /// Returns the signal strength for the Bluetooth connection with the peer device.
47 | ///
48 | public int Rssi { internal set; get; }
49 |
50 | ///
51 | /// Returns the Class of Device of the remote device.
52 | ///
53 | public uint ClassOfDevice { internal set; get; }
54 |
55 | internal PenDevice( BluetoothDeviceInfo device )
56 | {
57 | Name = device.DeviceName;
58 | Address = device.DeviceAddress.ToString();
59 | Authenticated = device.Authenticated;
60 | LastSeen = device.LastSeen;
61 | LastUsed = device.LastUsed;
62 | Remembered = device.Remembered;
63 | Rssi = device.Rssi;
64 | ClassOfDevice = device.ClassOfDevice.Value;
65 | }
66 |
67 | ///
68 | /// Returns a String that represents the current Object.
69 | ///
70 | /// A string that represents the current object.
71 | public override string ToString()
72 | {
73 | return Address + "[" + Name + "]";
74 | }
75 | }
76 |
77 | ///
78 | /// Provides client connections for Bluetooth RFCOMM network services.
79 | ///
80 | public class BluetoothAdapter
81 | {
82 | ///
83 | /// The delegate models a callback to get Class of Device when connection is established.
84 | ///
85 | /// Class of Device of the remote device
86 | public delegate void OnConnected( uint deviceClass );
87 |
88 | private BluetoothClient mBtClient;
89 |
90 | private readonly string ALLOWED_MAC_PREFIX = "9C7BD";
91 |
92 | private readonly bool ALLOW_OTHER_CONNECTION = true;
93 |
94 | private object mConnLock = new object();
95 |
96 | ///
97 | /// Returns the Class of Device of the remote device.
98 | ///
99 | public uint DeviceClass { private set; get; }
100 |
101 | ///
102 | /// Gets a name of a device.
103 | ///
104 | public string DeviceName { private set; get; }
105 |
106 | ///
107 | /// Gets the device identifier.
108 | ///
109 | public string DeviceAddress { private set; get; }
110 |
111 | ///
112 | /// A constructor that constructs a BluetoothAdapter
113 | ///
114 | public BluetoothAdapter()
115 | {
116 | }
117 |
118 | ///
119 | /// Specifies whether the device is connected.
120 | ///
121 | public bool Connected
122 | {
123 | get { return mBtClient != null && mBtClient.Connected; }
124 | }
125 |
126 | ///
127 | /// Specifies whether the bluetooth adapter is enabled.
128 | ///
129 | public bool Enabled
130 | {
131 | get
132 | {
133 | try
134 | {
135 | BluetoothClient bc = new BluetoothClient();
136 | return true;
137 | }
138 | catch ( System.PlatformNotSupportedException )
139 | {
140 | return false;
141 | }
142 | }
143 | }
144 |
145 | ///
146 | /// Discovers accessible Bluetooth devices, both remembered and in-range, and returns their names and addresses.
147 | ///
148 | /// An array of PenDevice objects describing the devices discovered.
149 | public PenDevice[] FindAllDevices()
150 | {
151 | List devices = new List();
152 |
153 | try
154 | {
155 | BluetoothClient bc = new BluetoothClient();
156 | BluetoothDeviceInfo[] array = bc.DiscoverDevices();
157 |
158 | foreach ( BluetoothDeviceInfo device in array )
159 | {
160 | if ( ValidateAddress( device.DeviceAddress.ToString() ) )
161 | {
162 | devices.Add( new PenDevice( device ) );
163 | }
164 | }
165 | }
166 | catch ( System.PlatformNotSupportedException )
167 | {
168 | return null;
169 | }
170 |
171 | return devices.ToArray();
172 | }
173 |
174 | private bool ValidateAddress( string mac )
175 | {
176 | return mac.StartsWith( ALLOWED_MAC_PREFIX );
177 | }
178 |
179 | private uint FindDeviceClass( string address )
180 | {
181 | RegistryKey registryKey = Registry.CurrentUser.CreateSubKey( "Software" ).CreateSubKey( "NeoLAB PenSDK" ).CreateSubKey( "Devices" );
182 |
183 | foreach ( string addr in registryKey.GetSubKeyNames() )
184 | {
185 | if ( addr == address )
186 | {
187 | RegistryKey devicekey = registryKey.OpenSubKey( address );
188 |
189 | uint cod = Convert.ToUInt32( devicekey.GetValue( "COD", 0, RegistryValueOptions.None ) );
190 |
191 | if ( cod != 0 )
192 | {
193 | return cod;
194 | }
195 | }
196 | }
197 |
198 | return 0;
199 | }
200 |
201 | private void WriteDeviceClass( string address, uint deviceClass )
202 | {
203 | RegistryKey registryKey = Registry.CurrentUser.CreateSubKey( "Software" ).CreateSubKey( "NeoLAB PenSDK" ).CreateSubKey( "Devices" );
204 |
205 | registryKey.DeleteSubKey( address, false );
206 |
207 | RegistryKey devicekey = registryKey.CreateSubKey( address );
208 |
209 | devicekey.SetValue( "COD", deviceClass );
210 |
211 | devicekey.Flush();
212 | devicekey.Close();
213 | }
214 |
215 | ///
216 | /// Connects the client to a remote Bluetooth host using the specified mac address and OnConnected handler.
217 | ///
218 | /// The mac address of the remote host.
219 | /// The delegate to handle connecting event.
220 | /// true if the BluetoothAdapter was connected to a remote resource; otherwise, false.
221 | public bool Connect( string mac, OnConnected handler )
222 | {
223 | BluetoothAddress bta = new BluetoothAddress( Convert.ToInt64( mac, 16 ) );
224 | BluetoothEndPoint rep = new BluetoothEndPoint( bta, BluetoothService.SerialPort );
225 |
226 | lock ( mConnLock )
227 | {
228 | try
229 | {
230 | if ( ( Connected && !ALLOW_OTHER_CONNECTION ) || !ValidateAddress( mac ) )
231 | {
232 | return false;
233 | }
234 |
235 | Disconnect();
236 |
237 | RemovePairedDevice( mac );
238 |
239 | EventHandler authHandler = new EventHandler( handleRequests );
240 | BluetoothWin32Authentication authenticator = new BluetoothWin32Authentication( authHandler );
241 |
242 | // 페어링 요청
243 | BluetoothSecurity.PairRequest( bta, null );
244 |
245 | mBtClient = new BluetoothClient();
246 | mBtClient.Connect( rep );
247 |
248 | authenticator.Dispose();
249 |
250 | DeviceClass = DeviceClass != 0 ? DeviceClass : FindDeviceClass( mac );
251 |
252 | if ( DeviceClass == 0 )
253 | {
254 | mBtClient.Dispose();
255 | return false;
256 | }
257 |
258 | WriteDeviceClass( mac, DeviceClass );
259 |
260 | DeviceAddress = mac;
261 |
262 | handler( DeviceClass );
263 | }
264 | catch
265 | {
266 | return false;
267 | }
268 |
269 | return true;
270 | }
271 | }
272 |
273 | private void handleRequests( Object thing, BluetoothWin32AuthenticationEventArgs args )
274 | {
275 | System.Console.WriteLine( "BluetoothWin32AuthenticationEventArgs ( AuthenticationMethod : {0}, AuthenticationRequirements : {1}, NumberOrPasskey : {2}, COD : {3:X} )", args.AuthenticationMethod, args.AuthenticationRequirements, args.NumberOrPasskey, args.Device.ClassOfDevice.Value );
276 |
277 | DeviceClass = args.Device.ClassOfDevice.Value;
278 |
279 | DeviceName = args.Device.DeviceName;
280 |
281 | args.Confirm = true;
282 | }
283 |
284 | ///
285 | /// Closes the Bluetooth socket and the underlying connection.
286 | ///
287 | /// true if the BluetoothAdapter was disconnected to a remote resource; otherwise, false.
288 | public bool Disconnect()
289 | {
290 | lock ( mConnLock )
291 | {
292 | if ( Connected )
293 | {
294 | mBtClient.Close();
295 | return true;
296 | }
297 |
298 | return false;
299 | }
300 | }
301 |
302 | ///
303 | /// Remove the pairing with the specified device.
304 | ///
305 | /// Remote device's mac address with which to remove pairing.
306 | public void RemovePairedDevice( string addr )
307 | {
308 | BluetoothAddress bta = new BluetoothAddress( Convert.ToInt64( addr, 16 ) );
309 | BluetoothSecurity.RemoveDevice( bta );
310 | }
311 |
312 | ///
313 | /// Bind the bluetooth socket with IPenComm class.
314 | ///
315 | /// Provides data handling for Neosmartpen Devices.
316 | /// The name of IPenComm instance
317 | public void Bind( IPenComm comm, string name = null )
318 | {
319 | comm.Bind( mBtClient.Client, name == null ? DeviceAddress : name );
320 | }
321 | }
322 | }
323 |
--------------------------------------------------------------------------------
/Neosmartpen.Net.Protocol.v2/Neosmartpen/Net/Protocol/v2/PenCommV2Callbacks.cs:
--------------------------------------------------------------------------------
1 | namespace Neosmartpen.Net.Protocol.v2
2 | {
3 | ///
4 | /// The PenCommV2Callbacks interface models a callback used when the the Neo smartpen needs to notify the client side.
5 | /// Please note that the implementation of the PenCommV2Callbacks run on main read thread. so if you want to do heavy work in callback method block, you have to run your code asyncronously.
6 | ///
7 | public interface PenCommV2Callbacks
8 | {
9 | ///
10 | /// Fired when a connection is made, override to handle in your own code.
11 | ///
12 | /// sender refers to the object that invoked the callback method
13 | /// Gets the device identifier.
14 | /// Gets a name of a device.
15 | /// current version of pen's firmware.
16 | /// Gets a version of a protocol.
17 | /// Gets a subname of a device.
18 | /// Gets the maximum level of force sensor.
19 | void onConnected( IPenComm sender, string macAddress, string deviceName, string fwVersion, string protocolVersion, string subName, int maxForce );
20 |
21 | ///
22 | /// Fired when your connection is authenticated.
23 | /// When it fired, you can use all function of pen.
24 | ///
25 | /// sender refers to the object that invoked the callback method
26 | void onPenAuthenticated( IPenComm sender );
27 |
28 | ///
29 | /// Fired when a connection is destroyed, override to handle in your own code.
30 | ///
31 | /// sender refers to the object that invoked the callback method
32 | void onDisconnected( IPenComm sender );
33 |
34 | ///
35 | /// Fired when receive a dot successfully, override to handle in your own code.
36 | ///
37 | /// sender refers to the object that invoked the callback method
38 | /// model object of dot
39 | /// model object of image processing. if data transmission type is request-response, you can get image processing info
40 | void onReceiveDot( IPenComm sender, Dot dot, ImageProcessingInfo info );
41 |
42 | ///
43 | /// Fired when receive offline data list in Neo smartpen.
44 | /// When you received this signal, you can request offline data to PenCommV2 by ReqOfflineData method.
45 | ///
46 | /// sender refers to the object that invoked the callback method
47 | /// array of OfflineNote object
48 | void onReceiveOfflineDataList( IPenComm sender, params OfflineDataInfo[] offlineNotes );
49 |
50 | ///
51 | /// Fired when started downloading, override to handle in your own code.
52 | ///
53 | /// sender refers to the object that invoked the callback method
54 | void onStartOfflineDownload( IPenComm sender );
55 |
56 | ///
57 | /// This method is invoked by the PenCommV2 when it needs to notify the client side about the status of an download operation being performed.
58 | ///
59 | /// sender refers to the object that invoked the callback method
60 | /// amount of total work
61 | /// amount of work done
62 | /// array of stroke object
63 | void onReceiveOfflineStrokes( IPenComm sender, int total, int amountDone, Stroke[] strokes );
64 |
65 | ///
66 | /// Fired when finished downloading, override to handle in your own code.
67 | ///
68 | /// sender refers to the object that invoked the callback method
69 | /// result of downloading
70 | void onFinishedOfflineDownload( IPenComm sender, bool result );
71 |
72 | ///
73 | /// Fired when removed offline data, override to handle in your own code.
74 | ///
75 | /// sender refers to the object that invoked the callback method
76 | /// true if your request is successfully applied, otherwise false
77 | void onRemovedOfflineData( IPenComm sender, bool result );
78 |
79 | ///
80 | /// Fired when received status of pen, override to handle in your own code.
81 | ///
82 | /// sender refers to the object that invoked the callback method
83 | /// true if pen is locked, otherwise false
84 | /// maximum password input count
85 | /// current password input count
86 | /// timestamp, pen knew
87 | /// the status of the auto shutdown time property
88 | /// maximum level of pressure sensor
89 | /// battery status of pen
90 | /// memory status of pen
91 | /// true if offline data available, otherwise false
92 | /// the status of the auto power on property that if write the unpowered pen, power on.
93 | /// true if enable to control power by cap, otherwise false
94 | /// the status of the hover mode property
95 | /// the status of the beep property
96 | /// the status of pen's sensitivity property
97 | /// the status of the usb mode
98 | /// true if enable to down sampling, otherwise false
99 | /// the local name of device
100 | /// the type of data transmission
101 | void onReceivePenStatus( IPenComm sender, bool locked, int passwdMaxReTryCount, int passwdRetryCount, long timestamp, short autoShutdownTime, int maxForce, int battery, int usedmem, bool useOfflineData, bool autoPowerOn, bool penCapPower, bool hoverMode, bool beep, short penSensitivity, PenCommV2.UsbMode usbmode, bool downsampling, string btLocalName, PenCommV2.DataTransmissionType dataTransmissionType );
102 |
103 | ///
104 | /// Fired when pen request a password to client side.
105 | /// When you received this signal, you have to enter password by PenCommV2.InputPassword method.
106 | ///
107 | /// sender refers to the object that invoked the callback method
108 | /// count of enter password
109 | /// if retry count reached reset count, delete all data in pen
110 | void onPenPasswordRequest( IPenComm sender, int retryCount, int resetCount );
111 |
112 | ///
113 | /// Fired when pen response to your request that change password by PenCommV2.InputPassword method.
114 | ///
115 | /// sender refers to the object that invoked the callback method
116 | /// true if your request is successfully applied, otherwise false
117 | void onPenPasswordSetUpResponse( IPenComm sender, bool result );
118 |
119 | ///
120 | /// Fired when pen response to your request that enable offline data.
121 | ///
122 | /// sender refers to the object that invoked the callback method
123 | /// true if your request is successfully applied, otherwise false
124 | void onPenOfflineDataSetUpResponse( IPenComm sender, bool result );
125 |
126 | ///
127 | /// Fired when pen response to your request that sets timestamp.
128 | ///
129 | /// sender refers to the object that invoked the callback method
130 | /// true if your request is successfully applied, otherwise false
131 | void onPenTimestampSetUpResponse( IPenComm sender, bool result );
132 |
133 | ///
134 | /// Fired when pen response to your request that sets the value of the sensitivity property by PenCommV2.ReqSetupPenSensitivity method.
135 | ///
136 | /// sender refers to the object that invoked the callback method
137 | /// true if your request is successfully applied, otherwise false
138 | void onPenSensitivitySetUpResponse( IPenComm sender, bool result );
139 |
140 | ///
141 | /// Fired when pen response to your request that sets the value of the auto shutdown time by PenCommV2.ReqSetupPenAutoShutdownTime method.
142 | ///
143 | /// sender refers to the object that invoked the callback method
144 | /// true if your request is successfully applied, otherwise false
145 | void onPenAutoShutdownTimeSetUpResponse( IPenComm sender, bool result );
146 |
147 | ///
148 | /// Fired when pen response to your request that sets the status of the auto power on property by PenCommV2.ReqSetupPenBeep method.
149 | ///
150 | /// sender refers to the object that invoked the callback method
151 | /// true if your request is successfully applied, otherwise false
152 | void onPenAutoPowerOnSetUpResponse( IPenComm sender, bool result );
153 |
154 | ///
155 | /// Fired when pen response to your request that sets enabling control by cap.
156 | ///
157 | /// sender refers to the object that invoked the callback method
158 | /// true if your request is successfully applied, otherwise false
159 | void onPenCapPowerOnOffSetupResponse( IPenComm sender, bool result );
160 |
161 | ///
162 | /// Fired when pen response to your request that Sets the status of the beep property by PenCommV2.ReqSetupPenBeep method.
163 | ///
164 | /// sender refers to the object that invoked the callback method
165 | /// true if your request is successfully applied, otherwise false
166 | void onPenBeepSetUpResponse( IPenComm sender, bool result );
167 |
168 | ///
169 | /// Fired when pen response to your request that sets the status of the hover mode on property by PenCommV2.ReqSetupHoverMode method.
170 | ///
171 | /// sender refers to the object that invoked the callback method
172 | /// true if your request is successfully applied, otherwise false
173 | void onPenHoverSetUpResponse( IPenComm sender, bool result );
174 |
175 | ///
176 | /// Fired when pen response to your request that Sets the color of pen ink by PenCommV2.ReqSetupPenColor method.
177 | ///
178 | /// sender refers to the object that invoked the callback method
179 | /// true if your request is successfully applied, otherwise false
180 | void onPenColorSetUpResponse( IPenComm sender, bool result );
181 |
182 | ///
183 | /// Fired when pen response to your request that Sets the status of usb mode by PenCommV2.ReqSetupUsbMode method.
184 | ///
185 | /// sender refers to the object that invoked the callback method
186 | /// true if your request is successfully applied, otherwise false
187 | void onPenUsbModeSetUpResponse( IPenComm sender, bool result );
188 |
189 | ///
190 | /// Fired when pen response to your request that Sets the state of down sampling by PenCommV2.ReqSetupDownSampling method.
191 | ///
192 | /// sender refers to the object that invoked the callback method
193 | /// true if your request is successfully applied, otherwise false
194 | void onPenDownSamplingSetUpResponse(IPenComm sender, bool result);
195 |
196 | ///
197 | /// Fired when pen response to your request that Sets the local name of device by PenCommV2.ReqSetupBtLocalName method.
198 | ///
199 | /// sender refers to the object that invoked the callback method
200 | /// true if your request is successfully applied, otherwise false
201 | void onPenBtLocalNameSetUpResponse(IPenComm sender, bool result);
202 |
203 | ///
204 | /// Fired when pen response to your request that Sets the level of sensitivity(force sensor c-type) by PenCommV2.ReqSetupPenFscSensitivity method.
205 | ///
206 | /// sender refers to the object that invoked the callback method
207 | /// true if your request is successfully applied, otherwise false
208 | void onPenFscSensitivitySetUpResponse(IPenComm sender, bool result);
209 |
210 | ///
211 | /// Fired when pen response to your request that Sets the type of data transmission by PenCommV2.ReqSetupDataTransmissionType method.
212 | ///
213 | /// sender refers to the object that invoked the callback method
214 | /// true if your request is successfully applied, otherwise false
215 | void onPenDataTransmissionTypeSetUpResponse(IPenComm sender, bool result);
216 |
217 | ///
218 | /// This method is invoked by the PenCommV2 when it needs to notify the client side about the status of an firmware update operation being performed.
219 | ///
220 | /// sender refers to the object that invoked the callback method
221 | /// amount of total work
222 | /// amount of work done
223 | void onReceiveFirmwareUpdateStatus( IPenComm sender, int total, int amountDone );
224 |
225 | ///
226 | /// Fired when finished updating firmware, override to handle in your own code.
227 | ///
228 | /// sender refers to the object that invoked the callback method
229 | /// true if updating is successfully finished, otherwise false
230 | void onReceiveFirmwareUpdateResult( IPenComm sender, bool result );
231 |
232 | ///
233 | /// Fired when changed status of battery, override to handle in your own code.
234 | ///
235 | /// sender refers to the object that invoked the callback method
236 | /// percentage of battery
237 | void onReceiveBatteryAlarm( IPenComm sender, int battery );
238 | }
239 | }
240 |
--------------------------------------------------------------------------------