public void SendPackage(Package package)
        {
            try
            {
                if (_port != null && _port.IsOpen)
                {
                    var buffer = package.ToArray();
                    _port.Write(buffer, 0, buffer.Length);

                    WriteLog(package);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                throw;
            }
        }
Beispiel #2
0
 //comman methods for all inheritance
 public byte[] GetBytes()
 {
     var param = GetParams();
     var pkg = new Package(Channel, Function, param);
     return pkg.ToArray();
 }