public static ResponseDLL LoadAndListReaders() { ResponseDLL response = new ResponseDLL(); loadAndListReaders(_client, ref response); return(response); }
public static ResponseDLL ConnectClient(string reader, string ip, string port) { ResponseDLL response = new ResponseDLL(); connectClient(_client, reader, ip, port, ref response); return(response); }
public static ResponseDLL DisconnectClient() { ResponseDLL response = new ResponseDLL(); disconnectClient(_client, ref response); return(response); }
public static ResponseDLL InitClient() { ResponseDLL response = new ResponseDLL(); initClient(_client, ref response); return(response); }
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); }
public LogModel(int idClient, string nameClient, string request, ResponseDLL response) { _idClient = idClient; _nameClient = nameClient; _request = request; _response = response; _logTime = DateTime.Now.ToString("s").Replace(":", "."); }
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); }
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); }
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"); }
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); }
static private extern void connectClient(IntPtr client, string reader, string ip, string port, ref ResponseDLL ptr);
static private extern void loadAndListReaders(IntPtr client, ref ResponseDLL ptr);
static private extern void initClient(IntPtr client, ref ResponseDLL ptr);
static private extern void disconnectClient(IntPtr client, ref ResponseDLL ptr);
static private extern void initClient(IntPtr client, string jsonConfig, ref ResponseDLL ptr);