public void Disconnect() { SetGatewayState(GatewayState.Disconnected); if (connectionPort.IsConnected()) { connectionPort.Disconnect(); } }