--- ../org/gateway-1.0.3/gw/smsc_at.c	Tue Mar 27 15:40:38 2001
+++ ../gateway-1.0.3/gw/smsc_at.c	Wed Feb  6 13:39:18 2002
@@ -62,6 +62,7 @@
 #define WAVECOM		"wavecom"
 #define PREMICELL	"premicell"
 #define SIEMENS		"siemens"
+#define NOKIA7110	"nokia7110"
 
 /******************************************************************************
  * Open the connection
@@ -81,7 +82,10 @@
 	}
 
 	tcgetattr(fd, &tios);
-	if(strcmp(smsc->at_modemtype, SIEMENS) == 0) {
+	if ( strcmp( smsc->at_modemtype, SIEMENS ) == 0 ) {
+		cfsetospeed(&tios, B19200);  /* check radio pad parameter*/
+		cfsetispeed(&tios, B19200);
+	} else if ( strcmp( smsc->at_modemtype, NOKIA7110 ) == 0 ) {
 		cfsetospeed(&tios, B19200);  /* check radio pad parameter*/
 		cfsetispeed(&tios, B19200);
 	} else {
@@ -136,12 +140,14 @@
 	if (smsc->at_fd < 0)
 		goto error;
 
+  if ( strcmp( smsc->at_modemtype, NOKIA7110 ) == 0 ) sleep( 1 ); // wait for the modem
+
 	/* Turn Echo off on the modem: we don't need it */
 	if(send_modem_command(smsc->at_fd, "ATE0", 0) == -1)
 		goto error;
 	/* Check does the modem require a PIN and, if so, send it
 	 * This is not supported by the Nokia Premicell */
-	if(strcmp(smsc->at_modemtype, PREMICELL) != 0) {
+	if ( ( strcmp( smsc->at_modemtype, SIEMENS ) == 0 ) || ( strcmp( smsc->at_modemtype, WAVECOM ) == 0 ) ) {
 		ret = send_modem_command(smsc->at_fd, "AT+CPIN?", 0); 
 		if(ret == -1)
 			goto error;
@@ -476,7 +482,8 @@
 	
 	/* skip the SMSC address on the Wavecom (don't know about other modems -
 	 * Premicell doesn't need it) */
-	if(strcmp(smsc->at_modemtype, WAVECOM) == 0 
+	if(strcmp(smsc->at_modemtype, NOKIA7110) == 0 
+	    || strcmp(smsc->at_modemtype, WAVECOM) == 0 
 	    || strcmp(smsc->at_modemtype, SIEMENS) == 0) {
 		tmp = hexchar(octstr_get_char(buffer, pos))*16
 		    + hexchar(octstr_get_char(buffer, pos+1));
@@ -582,14 +589,15 @@
 	pos++;
 	
 	/* get the timestamp */
-	mtime.tm_year = octstr_get_char(pdu, pos) + 100; pos++;
-	mtime.tm_mon  = octstr_get_char(pdu, pos); pos++;
-	mtime.tm_mday = octstr_get_char(pdu, pos); pos++;
-	mtime.tm_hour = octstr_get_char(pdu, pos); pos++;
-	mtime.tm_min  = octstr_get_char(pdu, pos); pos++;
-	mtime.tm_sec = octstr_get_char(pdu, pos); pos++;
+	mtime.tm_year = ( ( octstr_get_char(pdu, pos) & 15 ) * 10 ) + ( octstr_get_char(pdu, pos) >> 4 ) + 100; pos++;
+	mtime.tm_mon  = ( ( octstr_get_char(pdu, pos) & 15 ) * 10 ) + ( octstr_get_char(pdu, pos) >> 4 ) - 1; pos++;
+	mtime.tm_mday = ( ( octstr_get_char(pdu, pos) & 15 ) * 10 ) + ( octstr_get_char(pdu, pos) >> 4 ); pos++;
+	mtime.tm_hour = ( ( octstr_get_char(pdu, pos) & 15 ) * 10 ) + ( octstr_get_char(pdu, pos) >> 4 ); pos++;
+	mtime.tm_min  = ( ( octstr_get_char(pdu, pos) & 15 ) * 10 ) + ( octstr_get_char(pdu, pos) >> 4 ); pos++;
+	mtime.tm_sec  = ( ( octstr_get_char(pdu, pos) & 15 ) * 10 ) + ( octstr_get_char(pdu, pos) >> 4 ); pos++;
+
 	/* time zone: */
-	mtime.tm_hour += octstr_get_char(pdu, pos); pos++;
+	mtime.tm_hour += ( ( octstr_get_char(pdu, pos) & 15 ) * 10 ) + ( octstr_get_char(pdu, pos) >> 4 ); pos++;
 	stime = mktime(&mtime);
 	
 	/* get data length */
