using System; using System.Collections.Generic; using System.IO.Ports; using System.Net.Sockets; using System.Text; using System.Threading; using System.Linq; namespace EDCSenderApp { public class EDCSender : IDisposable { private SerialPort serialPort; private TcpClient tcpClient; private NetworkStream networkStream; private bool isConnected; private ConnectionType connectionType; enum ConnectionType { None, Serial, TCP } // Constants for private const byte STX = 0x02; private const byte ETX = 0x03; private const byte ACK = 0x06; private const byte NAK = 0x15; public EDCSender() { serialPort = null; tcpClient = null; networkStream = null; isConnected = false; connectionType = ConnectionType.None; } // Fungsi untuk connect via Serial (COM Port) public bool ConnectSerial(string portName, int baudRate = 9600) { try { serialPort = new SerialPort(portName, baudRate) { DataBits = 8, StopBits = StopBits.One, Parity = Parity.None, Handshake = Handshake.None, ReadTimeout = 5000, WriteTimeout =...
EXPLORE INFORMATION : AI, BITCOIN, TECHNOLOGY