public void Init() { lock ( this ) // do this only once -- keep the lock until we're ready to go less we hose up the poll ptt thread { if ( Initialized ) return; if ( portNum == 0 ) return; // bail out commPort = new SDRSerialPort(portNum); commPort.Create(true); // true says to create bit bang only port -- fixme needs error checking! Initialized = true; } return; }
public void Destroy() { lock ( this ) // we only get in here once { if ( !Initialized ) return; Initialized = false; } if ( commPort != null ) { commPort.Destroy(); commPort = null; } }