Пример #1
0
        public static ResponseDLL LoadAndListReaders()
        {
            ResponseDLL response = new ResponseDLL();

            loadAndListReaders(_client, ref response);
            return(response);
        }
Пример #2
0
        public static ResponseDLL ConnectClient(string reader, string ip, string port)
        {
            ResponseDLL response = new ResponseDLL();

            connectClient(_client, reader, ip, port, ref response);
            return(response);
        }
Пример #3
0
        public static ResponseDLL DisconnectClient()
        {
            ResponseDLL response = new ResponseDLL();

            disconnectClient(_client, ref response);
            return(response);
        }
Пример #4
0
        public static ResponseDLL InitClient()
        {
            ResponseDLL response = new ResponseDLL();

            initClient(_client, ref response);
            return(response);
        }
Пример #5
0
        private bool CheckError(ResponseDLL packet)
        {
            bool   hasError    = false;
            string description = "none";

            if (packet.err_server_code != 0)
            {
                description = packet.err_server_description;
                hasError    = true;
            }
            else if (packet.err_client_code != 0)
            {
                description = packet.err_client_description;
                hasError    = true;
            }
            else if (packet.err_terminal_code != 0)
            {
                description = packet.err_terminal_description;
                hasError    = true;
            }
            else if (packet.err_card_code != 0)
            {
                description = packet.err_card_description;
                hasError    = true;
            }
            if (hasError)
            {
                MessageBox.Show("Error: " + description);
            }
            return(hasError);
        }
Пример #6
0
 public LogModel(int idClient, string nameClient, string request, ResponseDLL response)
 {
     _idClient   = idClient;
     _nameClient = nameClient;
     _request    = request;
     _response   = response;
     _logTime    = DateTime.Now.ToString("s").Replace(":", ".");
 }
Пример #7
0
        private void DelDisconnectClient()
        {
            APIClientModel old = _clientData.FirstOrDefault();

            if (old.ClientState.Equals("DISCONNECTED"))
            {
                MessageBox.Show("Error: Client already disconnected");
                return;
            }
            _clientData = new ObservableCollection <APIClientModel>();
            _clientData.Add(new APIClientModel("DISCONNECTED", old.IpClientConnected, old.PortClientConnected));
            OnPropertyChanged("ClientData");
            ResponseDLL response = APIClientWrapper.DisconnectClient();

            CheckError(response);
        }
Пример #8
0
        private ObservableCollection <ReaderModel> LoadReaders()
        {
            ResponseDLL response = APIClientWrapper.LoadAndListReaders();

            _readersList = new ObservableCollection <ReaderModel>();
            if (CheckError(response))
            {
                return(_readersList);
            }
            String[] data = response.response.Split('|');

            for (int i = 0; i < data.Length - 1; i += 2)
            {
                _readersList.Add(new ReaderModel(i / 2, data[i + 1]));
            }
            return(_readersList);
        }
Пример #9
0
        private void DelConnectClient()
        {
            if (_selectedReader == null)
            {
                MessageBox.Show("Error: A reader must be selected");
                return;
            }
            APIClientModel old      = _clientData.FirstOrDefault();
            ResponseDLL    response = APIClientWrapper.ConnectClient(_selectedReader.ReaderName, old.IpClientConnected, old.PortClientConnected);

            if (CheckError(response))
            {
                return;
            }
            _clientData = new ObservableCollection <APIClientModel>();
            _clientData.Add(new APIClientModel("CONNECTED", old.IpClientConnected, old.PortClientConnected));
            OnPropertyChanged("ClientData");
        }
Пример #10
0
        public static string RetrieveErrorDescription(ResponseDLL packet)
        {
            string description = NO_ERROR;

            if (packet.err_server_code != 0)
            {
                description = packet.err_server_description;
            }
            else if (packet.err_client_code != 0)
            {
                description = packet.err_client_description;
            }
            else if (packet.err_terminal_code != 0)
            {
                description = packet.err_terminal_description;
            }
            else if (packet.err_card_code != 0)
            {
                description = packet.err_card_description;
            }
            return(description);
        }
Пример #11
0
 static private extern void connectClient(IntPtr client, string reader, string ip, string port, ref ResponseDLL ptr);
Пример #12
0
 static private extern void loadAndListReaders(IntPtr client, ref ResponseDLL ptr);
Пример #13
0
 static private extern void initClient(IntPtr client, ref ResponseDLL ptr);
Пример #14
0
 static private extern void disconnectClient(IntPtr client, ref ResponseDLL ptr);
Пример #15
0
 static private extern void initClient(IntPtr client, string jsonConfig, ref ResponseDLL ptr);