genericopenlibs/cstdlib/TSTLIB/COMMINIT.CPP
changeset 0 e4d67989cc36
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/genericopenlibs/cstdlib/TSTLIB/COMMINIT.CPP	Tue Feb 02 02:01:42 2010 +0200
@@ -0,0 +1,50 @@
+// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Initialise Comm Server in an simple text shell environment
+// 
+//
+
+#include <e32base.h>
+#include <e32std.h>
+#include <f32file.h>
+#include <e32hal.h>
+
+#if defined (__WINS__)
+#define PDD_NAME _L("ECDRV")
+#define LDD_NAME _L("ECOMM")
+#define LDD_FNAME _L("ECOMM")
+#else
+#define PDD_NAME _L("EUART1")
+#define LDD_NAME _L("ECOMM")
+#define LDD_FNAME _L("FCOMM")
+#endif
+
+extern "C" {
+
+EXPORT_C int CommInit(int aEnhanced)
+	{
+	RFs fs;
+	TInt err=fs.Connect();	// make sure the FileServer is alive (only needed for WINS test code)
+	fs.Close();
+
+	err=User::LoadPhysicalDevice(PDD_NAME);
+	if (err!=KErrNone && err!=KErrAlreadyExists)
+		return(err);
+	err=User::LoadLogicalDevice( aEnhanced?LDD_FNAME:LDD_NAME );
+	if (err!=KErrNone && err!=KErrAlreadyExists)
+		return(err);
+	return KErrNone;
+	}
+
+}