Denver Ivan Gazo avatar Denver Ivan Gazo committed c2a5b04

Add some stuff

Comments (0)

Files changed (2)

FingerCommLib/ComList.cs

 
 namespace Tuldok
 {
-    public static sealed class ComList
+    public static class ComList
     {
         public static List<string> List()
         {

FingerCommLib/FingerCommLib.cs

                     ReceiveReadPattern(rdata);
                     break;
                 case 0x01:
-                    ReceiveAddUser(rdata);
+                    ReceiveAddFingerprint(rdata);
                     break;
                 case 0x02:
-                    ReceiveAddUser2(rdata);
+                    ReceiveAddFingerprint2(rdata);
                     break;
                 case 0x03:
-                    ReceiveAddUser3(rdata);
+                    ReceiveAddFingerprint3(rdata);
                     break;
                 case 0x04:
                     ReceiveDeleteUser(rdata);
         /// Function that is called after the first fingerprint sampling
         /// </summary>
         /// <param name="data"></param>
-        private void ReceiveAddUser(byte[] data)
+        private void ReceiveAddFingerprint(byte[] data)
         {
             if ((Q3Response)data[4] == Q3Response.ACK_SUCCESS)
             {
         /// Function that is called after the 2nd fingerprint sampling
         /// </summary>
         /// <param name="data"></param>
-        private void ReceiveAddUser2(byte[] data)
+        private void ReceiveAddFingerprint2(byte[] data)
         {
             if ((Q3Response)data[4] == Q3Response.ACK_SUCCESS)
             {
         /// Function that is called after the third fingerprint sampling
         /// </summary>
         /// <param name="data"></param>
-        private void ReceiveAddUser3(byte[] data)
+        private void ReceiveAddFingerprint3(byte[] data)
         {
             if ((Q3Response)data[4] == Q3Response.ACK_SUCCESS)
             {
             }
         }
 
+        /// <summary>
+        /// Function that is called when the priviledge level of a user is requested
+        /// </summary>
+        /// <param name="data"></param>
         private void ReceiveGetUserPriviledge(byte[] data)
         {
             if ((Q3Response)data[4] == Q3Response.ACK_NOUSER)
             }
         }
 
+        /// <summary>
+        /// Get Version String
+        /// </summary>
+        /// <param name="data"></param>
+        private void ReceiveVersionHeader(byte[] data)
+        {
+            if ((Q3Response)data[4] == Q3Response.ACK_FAIL
+            {
+                // TODO: put code to handle version header request failure
+            }
+            else if ((Q3Response)data[4] == Q3Response.ACK_SUCCESS)
+            {
+                int len = (((int)data[2]) << 8) + (int)data[3];
+                byte[] buffer = new byte[len + 3];
+                char[] chars = new char[len + 1];
+                ComPort.Read(buffer, 0, len + 4);
+
+                for (int i = 1; i < len + 1; i++)
+                {
+                    chars[i - 1] = (char)buffer[i];
+                }
+                
+                // Eto na yung version string. Kaw na bahala kung paano mo to i-uutilize.
+                string version = new string(chars);
+            }
+        }
+
         #endregion
 
         #region Sender Methods
             ComPort.Write(sendData, 0, 8);
         }
 
+        /// <summary>
+        /// Gets the DSP version. Can be used to verify that the device is working
+        /// </summary>
+        public void GetDSPVersion()
+        {
+            byte[] sendData = new byte[8] { 0xF5, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF5 };
+            sendData[6] = checksum(sendData, 1, 5);
+
+            ComPort.Write(sendData, 0, 8);
+        }
+
         #endregion
 
         #region Helper Methods
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.