public UnixNativeSerial()
 {
     m_Dll    = new SerialUnix();
     m_Handle = m_Dll.serial_init();
     if (m_Handle.Equals(IntPtr.Zero))
     {
         throw new PlatformNotSupportedException("Can't initialise platform library");
     }
 }
Esempio n. 2
0
        public UnixNativeSerial()
        {
            m_Dll = new SerialUnix();
            m_Handle = m_Dll.serial_init();
            if (m_Handle.IsInvalid) {
                throw new PlatformNotSupportedException("Can't initialise platform library");
            }
            m_HandlePtr = m_Handle.DangerousGetHandle();

#if NETSTANDARD15
            // On NetStandard 1.5, we must have proper exception handling
            try {
                // These methods were first added in libnserial 1.1
                m_Dll.netfx_errno(0);
            } catch (System.EntryPointNotFoundException) {
                throw new PlatformNotSupportedException("Must have libnserial 1.1.0 or later on .NET Standard 1.5");
            }
#endif
        }