Example #1
0
        public void RedAsync()
        {
            string color   = ValidatorEnv.IsExit() ? ExitLightRed : EntryLightRed;
            int    timeout = _timeoutSec;
            string cmd     = "<commands>" +
                             "<command>" +
                             "<name>SetLED</name>" +
                             "<params>" +
                             "<param><key>" + color + "</key><value>on</value></param>" +
                             "<param><key>timeout</key><value>" + timeout * 1000 + "</value></param>" +
                             "</params>" +
                             "</command>" +
                             "</commands>";

            Net45Task.Run(() =>
            {
                HttpSync(cmd, gateUrl);
            });

            PlayErrorSongAsync();


            // TODO no need it for now
            //whenever a 'normal' command executed ,reset the 'long open/close' command
            //_toggleOpenCloseCommand.Reset();
            // TODO no need it for now
        }
Example #2
0
        public void HeartbeatServiceNonBlockIO()
        {
            var baseUrl_wirecard = ValidatorEnv.DeviceControllerHeartbeatUrl;
            var interval         = ValidatorEnv.DeviceControllerHeartbeatIntervalSec;
            var baseUrl_pico     = ValidatorEnv.DeviceControllerPincodeHeartbeatUrl;

            Net45Task.Run(() =>
            {
                while (true)
                {
                    if (ValidatorEnv.IsExit())
                    {
                        try
                        {
                            var url = baseUrl_wirecard + "?status=" + ExitReader_Status.ToString().ToLowerInvariant()
                                      + "&type=A";
                            //_log.Debug("[Heartbeat Exit Reader] : " + url);
                            HttpSync("", url, "POST", false);
                        }
                        catch (Exception ex)
                        {
                            //_log.Error(ex);
                        }
                    }
                    else
                    {
                        try
                        {
                            var url = baseUrl_wirecard + "?status=" + EntryReader_Status.ToString().ToLowerInvariant()
                                      + "&type=B";
                            //_log.Debug("[Heartbeat Entry Reader] : " + url);
                            HttpSync("", url, "POST", false);
                        }
                        catch (Exception ex)
                        {
                            //_log.Error(ex);
                        }
                        try
                        {
                            var url = baseUrl_pico + "?status=" + PicoReader_Status.ToString().ToLowerInvariant();
                            //_log.Debug("[Heartbeat Pico Reader] : " + url);
                            HttpSync("", url, "POST", false);
                        }
                        catch (Exception ex)
                        {
                            //_log.Error(ex);
                        }
                    }

                    Thread.Sleep(1000 * interval);
                }
            });
        }
Example #3
0
 public OfflineValidUsage(string ticketNo, string facilityId, string operationId, string itemDescription, string direction = "entry", string remarks = "")
 {
     TicketNumber    = ticketNo;
     FacilityID      = facilityId;
     OperationID     = operationId;
     UsageDate       = DateTime.Now;
     ValidatorID     = ValidatorEnv.ValidatorID();
     SendedToServer  = "No";
     Direction       = direction;
     Remarks         = remarks;
     ItemDescription = itemDescription;
     OperatorId      = Login.LoggedInAdmin;
 }
Example #4
0
        public void OpenAndGreenAsync()
        {
            if (ValidatorEnv.IsExit())
            {
                Net45Task.Run(() =>
                {
                    ExitAndGreenSync();
                    PlayOkSongAsync();
                });
                return;
            }

            int    timeout = _timeoutSec;
            string cmd     = "<commands>" +
                             "<command>" +
                             "<name>SetLED</name>" +
                             "<params>" +
                             "<param><key>" + Entry + "</key><value>on</value></param>" +
                             "<param><key>timeout</key><value>" + timeout * 1000 + "</value></param>" +
                             "</params>" +
                             "</command>" +
                             "<command>" +
                             "<name>SetLED</name>" +
                             "<params>" +
                             "<param><key>" + EntryLightBlue + "</key><value>on</value></param>" +
                             "<param><key>timeout</key><value>" + timeout * 1000 + "</value></param>" +
                             "</params>" +
                             "</command>" +
                             "</commands>";

            Net45Task.Run(() =>
            {
                HttpSync(cmd, gateUrl);
            });

            PlayOkSongAsync();
        }
Example #5
0
 public string ToggleCommandXml()
 {
     if (_status == CLOSE)
     {
         _status = OPEN;
         if (ValidatorEnv.IsExit())
         {
             // open exit (B)
             string cmd = "<commands>" +
                          "<command><name>SetLED</name>" +
                          "<params>" +
                          "<param><key>gateB</key><value>on</value></param>" +
                          "<param><key>timeout</key><value>-1</value></param>" +
                          "</params>" +
                          "</command>" +
                          "</commands>";
             return(cmd);
         }
         else
         {
             var cmd = "<commands>" +
                       "<command>" +
                       "<name>SetLED</name>" +
                       "<params>" +
                       "<param><key>gateA</key><value>on</value>" +
                       "</param><param><key>timeout</key><value>-1</value></param>" +
                       "</params>" +
                       "</command>" +
                       "</commands>";
             // open entry (A)
             return(cmd);
         }
     }
     else
     {
         _status = CLOSE;
         if (ValidatorEnv.IsExit())
         {
             // close exit (B)
             string cmd = "<commands>" +
                          "<command><name>SetLED</name>" +
                          "<params>" +
                          "<param><key>gateB</key><value>off</value></param>" +
                          "<param><key>timeout</key><value>-1</value></param>" +
                          "</params>" +
                          "</command>" +
                          "</commands>";
             return(cmd);
         }
         else
         {
             // close entry   (A)
             string cmd = "<commands>" +
                          "<command><name>SetLED</name>" +
                          "<params>" +
                          "<param><key>gateA</key><value>off</value></param>" +
                          "<param><key>timeout</key><value>-1</value></param>" +
                          "</params>" +
                          "</command>" +
                          "</commands>";
             return(cmd);
         }
     }
 }