Untitled
unknown
plain_text
a year ago
1.5 kB
4
Indexable
public bool Connection() { if (Media.IsOpen) { Disconnect(false); } try { Media.Close(); Media.Open(); GXReplyData reply = new(); byte[] data; data = Client.SNRMRequest(); if (data != null) { if (!ReadDataBlock(data, reply)) return false; Client.ParseUAResponse(reply.Data); } foreach (var it in Client.AARQRequest()) { reply.Clear(); if (!ReadDataBlock(it, reply)) return false; } Client.ParseAAREResponse(reply.Data); reply.Clear(); if (Client.IsAuthenticationRequired) { foreach (var it in Client.GetApplicationAssociationRequest()) { reply.Clear(); if (!ReadDataBlock(it, reply)) return false; } Client.ParseApplicationAssociationResponse(reply.Data); } } catch (Exception ex) { Media.Close(); OnMessage($"Возникла ошибка при подключении к ПУ: {ex.Message}"); return false; } OnMessage("Успешное подключение к ПУ!"); return true; }
Editor is loading...
Leave a Comment