예제 #1
0
        public override void Dispose(bool disposing)
        {
            if (disposing)
            {
                // Code to clean up managed resources
                if (hScan != null)
                {
                    hScan.Execute("Scanner.CancelScan");
                    hScan.Close();
                    hScan = null;
                }

                if ((hKeyb != null) && hKeyb.IsOpen())
                {
                    hKeyb.LoadProfile(PREV_PROFILE);
                    hKeyb.SetDword("Keyboard.Reload", 1);
                    hKeyb.Close();
                    hKeyb = null;
                }
                if (hRfid != null)
                {
                    hRfid.Close();
                    hRfid = null;
                }
                if (((MerlinWiFi)base.WiFi).DrvWLAN != null)
                {
                    ((MerlinWiFi)base.WiFi).DrvWLAN.Close();
                }
                if (((MerlinWiFi)base.WiFi).DrvUtil != null)
                {
                    ((MerlinWiFi)base.WiFi).DrvUtil.Close();
                }
            }
            // Code to clean up unmanaged resources
        }
예제 #2
0
        /// Restore the SCAN -button from keaboard and
        /// Merlin's pistol grip TRIGGER -button
        /// </summary>
        static public void RestoreScanButtons()
        {
            try
            {
                // Restore SCAN -button from keaboard
                MHLDriver hKeyb = new MHLDriver("Keyboard");
                if (hKeyb.IsOpen())
                {
                    // Restore saved profile and close driver
                    hKeyb.LoadProfile("NurSample");
                    // Reload map
                    hKeyb.SetDword("Keyboard.Reload", 1);
                }
            }
            catch
            {
                // Ignore if not existing
            }

            try
            {
                // Restore TRIGGER -button from Merlins pistol grip
                MHLDriver hTrigger = new MHLDriver("TriggerButton");
                if (hTrigger.IsOpen())
                {
                    // Restore saved profile and close driver
                    hTrigger.LoadProfile("NurSample");
                }
            }
            catch
            {
                // Ignore if not existing
            }
        }
예제 #3
0
 public RFIDLabelInfo(int nT, MHLDriver hRf)
 {
     Drv        = hRf;
     nCurInList = nT;
     if (nT >= 0)
     {
         GetRFIDLabelInfo();
     }
 }
예제 #4
0
            public MerlinWiFi()
                : base()
            {
                string
                //sM,
                    s;

                hWlan = new MHLDriver();
                hUtil = new MHLDriver();
                try
                {
                    hWlan.Open("WLAN");
                    hUtil.Open("Utility");

                    //s = hWlan.GetString("WLAN.MacAddress").Replace(":", "").ToUpper();
                    //try
                    //{
                    //    s = hWlan.GetString("WLAN.MacAddress");
                    //}
                    //catch
                    //{
                    //    s = "";
                    //}
                    //if (s.Length == 0)

                    try
                    {
                        s = hUtil.GetString("Utility.MacAddress");
                    }
                    catch
                    {
                        s = "000000000000";
                    }
                    s = s.Replace(":", "").ToUpper();

                    //s = hUtil.GetString("Utility.MacAddress");
                    //s = hWlan.GetString("WLAN.MacAddress");
                    //sM = hUtil.GetString("Utility.MacAddress").Replace(":", "").ToUpper();
                    base.MACAddreess = s;

                    //base.STB = new CustPB(this, "cSym");
                    base.SigTB = new CustPB(this, "cSym");
                    base.ConfigTextBox(32, 25, 164, 18);

                    tmSig          = new System.Windows.Forms.Timer();
                    tmSig.Enabled  = false;
                    tmSig.Interval = 1000;
                    tmSig.Tick    += new EventHandler(tmSig_Tick);
                }
                catch (Exception ex)
                {
                    throw new Exception("WiFi не открыта!");
                }
            }
예제 #5
0
        public RFIDLabelInfo(string sCurInvent, MHLDriver hRf)
        {
            Drv        = hRf;
            nCurInList = -1;
            int i = sCurInvent.IndexOf("Slot");

            if (i >= 0)
            {
                nCurInList = int.Parse(sCurInvent.Substring(i + 5, 2));
                GetRFIDLabelInfo();
            }
        }
예제 #6
0
        private void TIDInfo(MHLDriver hRf)
        {
            bool
                bOld = hRf.throwsException;
            int nC   = 4;

            byte[]
            aSerial,
            aB;

            hRf.throwsException = false;
            hRf.SetDword("RFID.BlockPointer", 0);
            hRf.SetDword("RFID.BlockCount", nC);
            //aB = new byte[128];
            //aB = hRf.GetBin("RFID.EPCC1G2.Read");

            aB = hRf.GetBin("RFID.BlockData");

            nMDID = ((uint)aB[2]) >> 4;
            nMDID = ((uint)aB[1] << 8) + nMDID;

            nModNum = ((uint)aB[2]) & 0x0F;
            nModNum = (nModNum << 8) + ((uint)aB[3]);
            if ((aB[1] & 0x80) > 0)
            {// флаг XTID установлен
                XTIDPresent = true;
            }

            hRf.SetDword("RFID.BlockPointer", 6);
            hRf.SetDword("RFID.BlockCount", 6);
            aSerial = hRf.GetBin("RFID.BlockData");

            aTID = new byte[12];
            aB.CopyTo(aTID, 0);
            if (aSerial != null)
            {
                aSerial.CopyTo(aTID, 4);
                lSerialInt  = (long)((aSerial[0] << 8) + aSerial[1]) << 32;
                lSerialInt += (long)((aSerial[2] << 8) + aSerial[3]) << 16;
                lSerialInt += (long)((aSerial[4] << 8) + aSerial[5]);
            }

            hRf.throwsException = bOld;
        }
예제 #7
0
        /// Configures the SCAN -button from keaboard and
        /// Merlin's pistol grip TRIGGER -button.
        /// </summary>
        static public void ConfigureScanButtons(Keys keyCode)
        {
            try
            {
                // Configure SCAN -button from keaboard
                MHLDriver hKeyb = new MHLDriver("Keyboard");
                if (hKeyb.IsOpen())
                {
                    // Save current keyboard map
                    hKeyb.SaveProfile("NurSample");
                    // Ensure that "Scan" button is mapped correctly
                    hKeyb.SetDword("SpecialKey.Scan.All.VK", (uint)keyCode);
                    // Reload map
                    hKeyb.SetDword("Keyboard.Reload", 1);
                }
            }
            catch
            {
                // Ignore if not existing
            }

            try
            {
                // Configure TRIGGER -button from Merlins pistol grip
                MHLDriver hTrigger = new MHLDriver("TriggerButton");
                if (hTrigger.IsOpen())
                {
                    // Save the current Trigger -button map
                    hTrigger.SaveProfile("NurSample");
                    // Ensure that "Trigger" button is mapped correctly
                    hTrigger.SetDword("Trigger.VirtualKey", (uint)keyCode);
                }
            }
            catch
            {
                // Ignore if not existing
            }
        }
예제 #8
0
        private bool ReadersInit(string sProfName)
        {
            bool
                bSetVK,
                bRet = false;

            do
            {// MHL drivers
                hKeyb = new MHLDriver();
                try
                {
                    hKeyb.Open("Keyboard");
                }
                catch (Exception ex)
                {
                    throw new Exception("Клавиатура не открыта!");
                }
                // Hotkey capture
                hotkeyHelper = new HotkeyHelper();

                hScan = new MHLDriver();
                try
                {
                    hScan.Open("Scanner");
                    bRet = hScan.SetDword("Scanner.Timeout", 5);

                    bSetVK = hKeyb.SetDword("Keyboard.ScanMode", 0);
                    bSetVK = hKeyb.SetDword("SpecialKey.Scan.All.VK", BarCodeScanKey);
                }
                catch (Exception ex)
                {
                    throw new Exception("Сканер не открыт!");
                }

                if (RFIDScanKey > 0)
                {
                    hRfid = new MHLDriver();
                    try
                    {
                        hRfid.Open("RFID");
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("RFID Driver failure: " + ex.ToString());
                    }
                    if (hRfid.IsOpen())
                    {
                        try
                        {
                            //hRfid.SetString("RFID.TagType", "EPC C1G2");
                        }
                        catch (Exception ex)
                        {
                            throw new Exception("RFID Ttype failure: " + ex.ToString());
                        }
                    }
                }


                if (hKeyb.IsOpen())
                {
                    // Save current keyboard map
                    hKeyb.SaveProfile(sProfName);
                    // Map "Scan" button to VK_F12 (0x7B)
                    if (RFIDScanKey > 0)
                    {
                        //hKeyb.SetDword("SpecialKey.Square.All.VK", 0);
                        if (base.nTermType == TERM_TYPE.NRDMERLIN)
                        {
                            bool bn = hKeyb.SetDword("SpecialKey.Circle.All.VK", RFIDScanKey);
                        }
                    }
                    // Reload map
                    hKeyb.SetDword("Keyboard.Reload", 1);
                }


                hotkeyHelper.SetCallbackDelegate(new HotkeyHelper.HotkeyCallback(HandleScanKey));
                // Register BarCodeScanKey as global hotkey
                hotkeyHelper.RegisterKey(BarCodeScanKey, KeyModifiers.None);

                //hkHelperRFID = new HotkeyHelper();
                //hkHelperRFID.SetCallbackDelegate(new HotkeyHelper.HotkeyCallback(HandleRFIDScanKey));
                //hkHelperRFID.RegisterKey(RFIDScanKey, KeyModifiers.None);


                bRet = true;
            } while (false);

            return(bRet);
        }