Revision
16209
Author
gmaruzz
Date
2010-01-07 21:40:46 -0600 (Thu, 07 Jan 2010)

Log Message

gsmopen: compiles, loads and runs on win32. It does nothing, just query the modem for model name. but... IT - CAN - BE - DONE

Modified Paths

Diff

Modified: freeswitch/branches/gmaruzz/mod_gsmopen/gsmlib/gsmlib-1.10-patched-12ubuntu1/win32/gsmlib.vcproj (16208 => 16209)


--- freeswitch/branches/gmaruzz/mod_gsmopen/gsmlib/gsmlib-1.10-patched-12ubuntu1/win32/gsmlib.vcproj	2010-01-08 01:05:05 UTC (rev 16208)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/gsmlib/gsmlib-1.10-patched-12ubuntu1/win32/gsmlib.vcproj	2010-01-08 03:40:46 UTC (rev 16209)
@@ -100,6 +100,7 @@
 			UseOfMFC="0"
 			ATLMinimizesCRunTimeLibraryUsage="false"
 			CharacterSet="2"
+			ManagedExtensions="0"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
@@ -121,9 +122,9 @@
 				Optimization="0"
 				AdditionalIncludeDirectories="..,."
 				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
+				MinimalRebuild="false"
+				BasicRuntimeChecks="0"
+				RuntimeLibrary="3"
 				RuntimeTypeInfo="true"
 				PrecompiledHeaderFile=".\Debug/gsmlib.pch"
 				AssemblerListingLocation=".\Debug/"
@@ -131,7 +132,9 @@
 				ProgramDataBaseFileName=".\Debug/"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
-				DebugInformationFormat="4"
+				DebugInformationFormat="3"
+				DisableSpecificWarnings="4290"
+				OmitDefaultLibName="true"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -148,6 +151,8 @@
 				Name="VCLibrarianTool"
 				OutputFile=".\Debug\gsmlib.lib"
 				SuppressStartupBanner="true"
+				IgnoreAllDefaultLibraries="true"
+				IgnoreDefaultLibraryNames="msvcprtd "
 			/>
 			<Tool
 				Name="VCALinkTool"

Modified: freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen.h (16208 => 16209)


--- freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen.h	2010-01-08 01:05:05 UTC (rev 16208)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen.h	2010-01-08 03:40:46 UTC (rev 16209)
@@ -34,6 +34,11 @@
  *
  */
 
+#ifdef WIN32
+#define HAVE_VSNPRINTF
+#pragma warning(disable: 4290)
+#endif //WIN32
+
 #define MY_EVENT_INCOMING_SMS "gsmopen::incoming_sms"
 
 #undef GIOVA48
@@ -57,9 +62,11 @@
 #endif // NO_ALSA
 #include <switch.h>
 #include <switch_version.h>
+#ifndef WIN32
 #include <termios.h>
 #include <sys/ioctl.h>
 #include <iconv.h>
+#endif //WIN32
 #include <libteletone.h>
 
 #ifdef GSMOPEN_ALSA
@@ -319,7 +326,11 @@
 	char controldevprotocolname[50];	/*!< \brief name of the serial device controlling protocol, one of "at" "fbus2" "no_serial" "alsa_voicemodem" */
 	int controldevfd;			/*!< \brief serial controlling file descriptor for this interface */
 	//pthread_t controldev_thread;  /*!< \brief serial control thread for this interface, running during the call */
+#ifdef WIN32
+	int controldevice_speed;
+#else
 	speed_t controldevice_speed;
+#endif// WIN32
 	int controldev_dead;
 
 	char at_dial_pre_number[64];
@@ -489,7 +500,9 @@
 int remote_party_is_ringing(private_t * tech_pvt);
 int remote_party_is_early_media(private_t * tech_pvt);
 //int gsmopen_answer(private_t * tech_pvt, char *id, char *value);
+#if 0
 int gsmopen_transfer(private_t * tech_pvt, char *id, char *value);
+#endif //0
 int gsmopen_socket_create_and_bind(private_t * tech_pvt, int *which_port);
 
 
@@ -497,7 +510,11 @@
 
 
 void *gsmopen_do_controldev_thread(void *data);
+#ifdef WIN32
+int gsmopen_serial_init(private_t * tech_pvt, int controldevice_speed);
+#else
 int gsmopen_serial_init(private_t * tech_pvt, speed_t controldevice_speed);
+#endif //WIN32
 int gsmopen_serial_monitor(private_t * tech_pvt);
 int gsmopen_serial_sync(private_t * tech_pvt);
 int gsmopen_serial_sync_AT(private_t * tech_pvt);

Modified: freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp (16208 => 16209)


--- freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp	2010-01-08 01:05:05 UTC (rev 16208)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/gsmopen_protocol.cpp	2010-01-08 03:40:46 UTC (rev 16209)
@@ -1,5 +1,6 @@
 #include "gsmopen.h"
 //#include <iostream.h>
+
 #ifndef NO_GSMLIB
 #include <gsmlib/gsm_sms.h>
 #ifdef WIN32
@@ -15,7 +16,6 @@
 using namespace gsmlib;
 #endif// NO_GSMLIB
 
-
 #ifdef ASTERISK
 #define gsmopen_sleep usleep
 #define gsmopen_strncpy strncpy
@@ -36,8 +36,58 @@
 int option_debug = 100;
 
 
+#ifdef WIN32
+#define GSMLIBGIO
+#else //WIN32
+#undef GSMLIBGIO
+#endif //WIN32
 
-#undef GSMLIBGIO
+#ifdef WIN32
+/***************/
+// from http://www.openasthra.com/c-tidbits/gettimeofday-function-for-windows/
+
+#include <time.h>
+
+#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
+#define DELTA_EPOCH_IN_MICROSECS  11644473600000000Ui64
+#else /*  */
+#define DELTA_EPOCH_IN_MICROSECS  11644473600000000ULL
+#endif /*  */
+struct sk_timezone {
+	int tz_minuteswest;			/* minutes W of Greenwich */
+	int tz_dsttime;				/* type of dst correction */
+};
+int gettimeofday(struct timeval *tv, struct sk_timezone *tz)
+{
+	FILETIME ft;
+	unsigned __int64 tmpres = 0;
+	static int tzflag;
+	if (NULL != tv) {
+		GetSystemTimeAsFileTime(&ft);
+		tmpres |= ft.dwHighDateTime;
+		tmpres <<= 32;
+		tmpres |= ft.dwLowDateTime;
+
+		/*converting file time to unix epoch */
+		tmpres /= 10;			/*convert into microseconds */
+		tmpres -= DELTA_EPOCH_IN_MICROSECS;
+		tv->tv_sec = (long) (tmpres / 1000000UL);
+		tv->tv_usec = (long) (tmpres % 1000000UL);
+	}
+	if (NULL != tz) {
+		if (!tzflag) {
+			_tzset();
+			tzflag++;
+		}
+		tz->tz_minuteswest = _timezone / 60;
+		tz->tz_dsttime = _daylight;
+	}
+	return 0;
+}
+
+/***************/
+#endif /* WIN32 */
+
 #ifndef GSMLIBGIO
 int gsmopen_serial_init(private_t * tech_pvt, speed_t controldevice_speed)
 {
@@ -121,13 +171,17 @@
 	return (fd);
 }
 #else //GSMLIBGIO
+#ifdef WIN32
+int gsmopen_serial_init(private_t * tech_pvt, int controldevice_speed)
+#else 
 int gsmopen_serial_init(private_t * tech_pvt, speed_t controldevice_speed)
+#endif //WIN32
 {
 	int i;
 	string ciapa;
 
 #ifdef WIN32
-	Ref < Port > port = new Win32SerialPort((string) tech_pvt->controldevice_name, 38400);
+	Ref <Port> port = new Win32SerialPort((string) tech_pvt->controldevice_name, 38400);
 #else
 	//Ref<Port> port = new UnixSerialPort((string)argv[1], B38400);
 	Ref < Port > port = new UnixSerialPort((string) tech_pvt->controldevice_name, B115200);
@@ -135,7 +189,7 @@
 	MeTa m(port);
 
 	//cout << "Creating GsmAt object" << endl;
-	Ref < GsmAt > gsmat = new GsmAt(m);
+	Ref <GsmAt> gsmat = new GsmAt(m);
 
 	//cout << "Using GsmAt object" << endl;
 	//cout << gsmat->chat("AT", "OK", false, false) << endl;
@@ -144,11 +198,10 @@
 	for (i = 0; i < 4; i++) {
 		ciapa = gsmat->getLine();
 		//cout << "PRESO: |||" << ciapa << "|||" << endl;
-		ERRORA("PRESO %d |||%s|||\n", GSMOPEN_P_LOG, i, ciapa.c_str());
-		//usleep(5000);
+		NOTICA("PRESO %d |||%s|||\n", GSMOPEN_P_LOG, i, ciapa.c_str());
+		//gsmopen_sleep(5000);
 	}
 
-
 	return (-1);
 }
 
@@ -236,7 +289,7 @@
 /* initial_pause? */
 	if (tech_pvt->at_initial_pause) {
 		DEBUGA_GSMOPEN("sleeping for %d usec\n", GSMOPEN_P_LOG, tech_pvt->at_initial_pause);
-		usleep(tech_pvt->at_initial_pause);
+		gsmopen_sleep(tech_pvt->at_initial_pause);
 	}
 
 /* go until first empty preinit string, or last preinit string */
@@ -293,7 +346,7 @@
 /* after_preinit_pause? */
 	if (tech_pvt->at_after_preinit_pause) {
 		DEBUGA_GSMOPEN("sleeping for %d usec\n", GSMOPEN_P_LOG, tech_pvt->at_after_preinit_pause);
-		usleep(tech_pvt->at_after_preinit_pause);
+		gsmopen_sleep(tech_pvt->at_after_preinit_pause);
 	}
 
 	/* phone, brother, art you alive? */
@@ -307,7 +360,7 @@
 	if (res) {
 		DEBUGA_GSMOPEN("AT+mode=0 does not get OK from the phone. If it is NOT Motorola," " no problem.\n", GSMOPEN_P_LOG);
 	}
-	usleep(50000);
+	gsmopen_sleep(50000);
 	/* for motorola end */
 
 	/* reset AT configuration to phone default */
@@ -532,7 +585,7 @@
 
 int gsmopen_serial_sync_AT(private_t * tech_pvt)
 {
-	usleep(10000);				/* 10msec */
+	gsmopen_sleep(10000);				/* 10msec */
 	time(&tech_pvt->gsmopen_serial_synced_timestamp);
 	return 0;
 }
@@ -1021,7 +1074,7 @@
 				} else {
 					DEBUGA_GSMOPEN("|%s| +CMTI: Incoming SMS in position: %d!\n", GSMOPEN_P_LOG, tech_pvt->line_array.result[i], pos);
 					tech_pvt->unread_sms_msg_id = pos;
-					usleep(1000);
+					gsmopen_sleep(1000);
 
 					if (tech_pvt->unread_sms_msg_id) {
 						char at_command[256];
@@ -1754,7 +1807,7 @@
 
 		if (res != 1) {
 			DEBUGA_GSMOPEN("Error sending (%.1s): %d (%s)\n", GSMOPEN_P_LOG, &data[i], res, strerror(errno));
-			usleep(100000);
+			gsmopen_sleep(100000);
 			for (count = 0; count < 10; count++) {
 				res = write(tech_pvt->controldevfd, &data[i], 1);
 				if (res == 1) {
@@ -1762,7 +1815,7 @@
 					break;
 				} else
 					DEBUGA_GSMOPEN("Error RE-sending (%.1s): %d %d (%s)\n", GSMOPEN_P_LOG, &data[i], count, res, strerror(errno));
-				usleep(100000);
+				gsmopen_sleep(100000);
 
 			}
 			if (res != 1) {
@@ -1772,14 +1825,14 @@
 		}
 		if (option_debug > 1)
 			DEBUGA_GSMOPEN("sent data... (%.1s)\n", GSMOPEN_P_LOG, &data[i]);
-		usleep(1000);			/* release the cpu */
+		gsmopen_sleep(1000);			/* release the cpu */
 	}
 
 	res = write(tech_pvt->controldevfd, "\r", 1);
 
 	if (res != 1) {
 		DEBUGA_GSMOPEN("Error sending (carriage return): %d (%s)\n", GSMOPEN_P_LOG, res, strerror(errno));
-		usleep(100000);
+		gsmopen_sleep(100000);
 		for (count = 0; count < 10; count++) {
 			res = write(tech_pvt->controldevfd, "\r", 1);
 
@@ -1788,7 +1841,7 @@
 				break;
 			} else
 				DEBUGA_GSMOPEN("Error RE-sending (carriage return): %d %d (%s)\n", GSMOPEN_P_LOG, count, res, strerror(errno));
-			usleep(100000);
+			gsmopen_sleep(100000);
 
 		}
 		if (res != 1) {
@@ -1798,7 +1851,7 @@
 	}
 	if (option_debug > 1)
 		DEBUGA_GSMOPEN("sent (carriage return)\n", GSMOPEN_P_LOG);
-	usleep(1000);				/* release the cpu */
+	gsmopen_sleep(1000);				/* release the cpu */
 
 	return howmany;
 }
@@ -1817,14 +1870,14 @@
 
 		if (res != 1) {
 			DEBUGA_GSMOPEN("Error sending (%.1s): %d (%s)\n", GSMOPEN_P_LOG, &data[i], res, strerror(errno));
-			usleep(100000);
+			gsmopen_sleep(100000);
 			for (count = 0; count < 10; count++) {
 				res = write(tech_pvt->controldevfd, &data[i], 1);
 				if (res == 1)
 					break;
 				else
 					DEBUGA_GSMOPEN("Error RE-sending (%.1s): %d %d (%s)\n", GSMOPEN_P_LOG, &data[i], count, res, strerror(errno));
-				usleep(100000);
+				gsmopen_sleep(100000);
 
 			}
 			if (res != 1) {
@@ -1834,10 +1887,10 @@
 		}
 		if (option_debug > 1)
 			DEBUGA_GSMOPEN("sent data... (%.1s)\n", GSMOPEN_P_LOG, &data[i]);
-		usleep(1000);			/* release the cpu */
+		gsmopen_sleep(1000);			/* release the cpu */
 	}
 
-	usleep(1000);				/* release the cpu */
+	gsmopen_sleep(1000);				/* release the cpu */
 
 	return howmany;
 }
@@ -2075,6 +2128,7 @@
 int ucs2_to_utf8(private_t * tech_pvt, char *ucs2_in, char *utf8_out, size_t outbytesleft)
 {
 	char converted[16000];
+#ifndef WIN32
 	iconv_t iconv_format;
 	int iconv_res;
 	char *outbuf;
@@ -2123,12 +2177,14 @@
 		 GSMOPEN_P_LOG, iconv_res, inbuf, (int) inbytesleft, outbuf, (int) outbytesleft, converted, utf8_out);
 	iconv_close(iconv_format);
 
+#endif //WIN32
 	return 0;
 }
 
 int iso_8859_1_to_utf8(private_t * tech_pvt, char *iso_8859_1_in, char *utf8_out, size_t outbytesleft)
 {
 	char converted[16000];
+#ifndef WIN32
 	iconv_t iconv_format;
 	int iconv_res;
 	char *outbuf;
@@ -2169,6 +2225,7 @@
 
 	iconv_close(iconv_format);
 
+#endif //WIN32
 	return 0;
 }
 
@@ -2176,6 +2233,7 @@
 int utf_to_ucs2(private_t * tech_pvt, char *utf_in, size_t inbytesleft, char *ucs2_out, size_t outbytesleft)
 {
 	/* cicopet */
+#ifndef WIN32
 	iconv_t iconv_format;
 	int iconv_res;
 	char *outbuf;
@@ -2219,6 +2277,7 @@
 		strncat(ucs2_out, stringa2, ((outbytesleft - strlen(ucs2_out)) - 1));	//add the received line to the buffer
 		DEBUGA_GSMOPEN("stringa=%s, stringa2=%s, ucs2_out=%s\n", GSMOPEN_P_LOG, stringa, stringa2, ucs2_out);
 	}
+#endif //WIN32
 	return 0;
 }
 
@@ -2246,7 +2305,7 @@
 	tech_pvt->phone_callflow = CALLFLOW_CALL_ACTIVE;
 
 	while (tech_pvt->interface_state == GSMOPEN_STATE_RING) {
-		usleep(10000);			//10msec
+		gsmopen_sleep(10000);			//10msec
 	}
 	if (tech_pvt->interface_state != GSMOPEN_STATE_UP) {
 		ERRORA("call answering failed\n", GSMOPEN_P_LOG);
@@ -2292,7 +2351,7 @@
 
 	new_inbound_channel(tech_pvt);
 
-	usleep(10000);
+	gsmopen_sleep(10000);
 
 	session = switch_core_session_locate(tech_pvt->session_uuid_str);
 	if (session) {
@@ -2349,7 +2408,7 @@
 			}
 
 			while (tech_pvt->interface_state != GSMOPEN_STATE_DOWN) {
-				usleep(10000);	//10msec
+				gsmopen_sleep(10000);	//10msec
 			}
 			if (tech_pvt->interface_state != GSMOPEN_STATE_DOWN) {
 				ERRORA("call hangup failed\n", GSMOPEN_P_LOG);
@@ -3039,14 +3098,14 @@
 			}
 			DEBUGA_GSMOPEN("prepared!\n", GSMOPEN_P_LOG);
 		}
-		usleep(1000);
+		gsmopen_sleep(1000);
 		error = snd_pcm_start(tech_pvt->alsac);
 		if (error) {
 			ERRORA("snd_pcm_start failed, %s\n", GSMOPEN_P_LOG, snd_strerror(error));
 			return r;
 		}
 		DEBUGA_GSMOPEN("started!\n", GSMOPEN_P_LOG);
-		usleep(1000);
+		gsmopen_sleep(1000);
 	}
 
 	buf = __buf + AST_FRIENDLY_OFFSET / 2;
@@ -3079,7 +3138,7 @@
 	} else if (r == -EAGAIN) {
 		DEBUGA_GSMOPEN("ALSA read -EAGAIN, the soundcard is not ready to be read by gsmopen\n", GSMOPEN_P_LOG);
 		while (r == -EAGAIN) {
-			usleep(1000);
+			gsmopen_sleep(1000);
 
 			if (tech_pvt->alsa_capture_is_mono) {
 				r = snd_pcm_readi(tech_pvt->alsac, buf + readpos, left);
@@ -3248,7 +3307,7 @@
 			}
 		}
 	  uscita:
-		usleep(1000);
+		gsmopen_sleep(1000);
 
 		if (tech_pvt->at_cmgw[0]) {
 
@@ -3268,7 +3327,7 @@
 
 			tech_pvt->at_cmgw[0] = '\0';
 		}
-		//usleep(500000);             //.5 secs
+		//gsmopen_sleep(500000);             //.5 secs
 		UNLOCKA(tech_pvt->controldev_lock);
 		POPPA_UNLOCKA(&tech_pvt->controldev_lock);
 	}
@@ -3313,7 +3372,11 @@
 		WARNINGA("boost %s too large, using %d\n", GSMOPEN_P_LOG, s, BOOST_MAX);
 		*boost = BOOST_MAX;
 	}
+#ifdef WIN32
+	*boost = exp(log ((double)10) * *boost / 20) * BOOST_SCALE;
+#else
 	*boost = exp(log(10) * *boost / 20) * BOOST_SCALE;
+#endif //WIN32
 	if (option_debug > 1)
 		DEBUGA_GSMOPEN("setting boost %s to %f\n", GSMOPEN_P_LOG, s, *boost);
 }
@@ -3362,14 +3425,14 @@
 	if (res) {
 		ERRORA("AT was not acknowledged, continuing but maybe there is a problem\n", GSMOPEN_P_LOG);
 	}
-	usleep(1000);
+	gsmopen_sleep(1000);
 
 	if (strlen(p->at_query_battchg)) {
 		res = gsmopen_serial_write_AT_expect(p, p->at_query_battchg, p->at_query_battchg_expect);
 		if (res) {
 			WARNINGA("%s does not get %s from the phone. Continuing.\n", GSMOPEN_P_LOG, p->at_query_battchg, p->at_query_battchg_expect);
 		}
-		usleep(1000);
+		gsmopen_sleep(1000);
 	}
 
 	if (strlen(p->at_query_signal)) {
@@ -3377,7 +3440,7 @@
 		if (res) {
 			WARNINGA("%s does not get %s from the phone. Continuing.\n", GSMOPEN_P_LOG, p->at_query_signal, p->at_query_signal_expect);
 		}
-		usleep(1000);
+		gsmopen_sleep(1000);
 	}
 	//FIXME all the following commands in config!
 
@@ -3388,7 +3451,7 @@
 				("%s does not get %s from the phone. If your phone is not Motorola, please contact the gsmopen developers. Else, if your phone IS a Motorola, probably a long msg was incoming and ther first part was read and then deleted. The second part is now orphan. If you got this warning  repeatedly, and you cannot correctly receive SMSs from this interface, please manually clean all messages (and the residual parts of them) from the cellphone/SIM. Continuing.\n",
 				 GSMOPEN_P_LOG, "AT+MMGL=\"HEADER ONLY\"", "OK");
 		} else {
-			usleep(1000);
+			gsmopen_sleep(1000);
 			if (p->unread_sms_msg_id) {
 				char at_command[256];
 

Modified: freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.2008.vcproj (16208 => 16209)


--- freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.2008.vcproj	2010-01-08 01:05:05 UTC (rev 16208)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.2008.vcproj	2010-01-08 03:40:46 UTC (rev 16209)
@@ -3,7 +3,7 @@
 	ProjectType="Visual C++"
 	Version="9,00"
 	Name="mod_gsmopen"
-	ProjectGUID="{13DD2A62-6348-4D2D-8F3F-6D29D38AB60D}"
+	ProjectGUID="{74B120FF-6935-4DFE-A142-CDB6BEA99C90}"
 	RootNamespace="mod_skypiax"
 	Keyword="Win32Proj"
 	TargetFrameworkVersion="131072"
@@ -39,6 +39,8 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;gsmlib\gsmlib-1.10-patched-12ubuntu1&quot;"
+				PreprocessorDefinitions="NO_ALSA"
 				UsePrecompiledHeader="0"
 				WarningLevel="4"
 				WarnAsError="false"
@@ -54,7 +56,9 @@
 			/>
 			<Tool
 				Name="VCLinkerTool"
-				AdditionalOptions="rpcrt4.lib "
+				AdditionalOptions=" gsmlib.lib &quot;..\..\..\..\w32\library\debug\freeswitchcore.lib&quot; /xNODEFAULTLIB:msvcprtd /NODEFAULTLIB:LIBCMTD &quot;..\..\..\..\libs\libteletone\Debug\libteletone.lib&quot;&#x0D;&#x0A;ksuser.lib    &#x0D;&#x0A;&quot;..\..\..\..\libs\win32\apr\debug\libapr-1.lib&quot; /xNODEFAULTLIB:MSVCRTD"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="&quot;gsmlib/gsmlib-1.10-patched-12ubuntu1/win32/Debug/&quot;"
 				RandomizedBaseAddress="1"
 				DataExecutionPrevention="0"
 			/>

Modified: freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp (16208 => 16209)


--- freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp	2010-01-08 01:05:05 UTC (rev 16208)
+++ freeswitch/branches/gmaruzz/mod_gsmopen/mod_gsmopen.cpp	2010-01-08 03:40:46 UTC (rev 16209)
@@ -37,6 +37,7 @@
 #include "gsmopen.h"
 #define MDL_CHAT_PROTO "SMS"
 
+#if 0
 #ifdef WIN32
 /***************/
 // from http://www.openasthra.com/c-tidbits/gettimeofday-function-for-windows/
@@ -82,9 +83,12 @@
 
 /***************/
 #endif /* WIN32 */
+#endif //0
+SWITCH_BEGIN_EXTERN_C
 SWITCH_MODULE_LOAD_FUNCTION(mod_gsmopen_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_gsmopen_shutdown);
 SWITCH_MODULE_DEFINITION(mod_gsmopen, mod_gsmopen_load, mod_gsmopen_shutdown, NULL);
+SWITCH_END_EXTERN_C
 #if 0
 SWITCH_STANDARD_API(sk_function);
 /* BEGIN: Changes here */
@@ -834,7 +838,11 @@
 	}
 #ifdef BIGENDIAN
 	if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
+#ifdef WIN32
+		switch_swap_linear((int16_t *)frame->data, (int) frame->datalen / 2);
+#else
 		switch_swap_linear(frame->data, (int) frame->datalen / 2);
+#endif //WIN32
 	}
 #endif
 
@@ -1259,7 +1267,11 @@
 #endif // GSMOPEN_ALSA
 
 			uint32_t interface_id = 0;
+#ifdef WIN32
+			int controldevice_speed = 115200;	//FIXME TODO
+#else
 			uint32_t controldevice_speed = B115200;	//FIXME TODO
+#endif //WIN32
 			uint32_t controldevprotocol = PROTOCOL_AT;	//FIXME TODO
 			uint32_t running = 1;	//FIXME TODO
 
@@ -2308,6 +2320,7 @@
 }
 #endif //0
 
+#if 0
 int gsmopen_transfer(private_t * tech_pvt, char *id, char *value)
 {
 	char msg_to_gsmopen[1024];
@@ -2427,6 +2440,7 @@
 	}
 	return 0;
 }
+#endif //0
 
 void *gsmopen_do_gsmopenapi_thread_func(void *obj)
 {
@@ -2479,7 +2493,7 @@
 				//FIXME ERRORA("gsmopen_new failed! BAD BAD BAD\n", GSMOPEN_P_LOG);
 				//FIXME }
 			}
-			usleep(100);		//give other threads a chance
+			switch_sleep(100);		//give other threads a chance
 			time(&now_timestamp);
 
 			if ((now_timestamp - tech_pvt->gsmopen_serial_synced_timestamp) > 30) {	//TODO find a sensible period. 5min? in config?