All pastes #352012 Raw Edit

Diff

public text v1 · immutable
·published 2007-02-12 15:05 UTC
rendered paste body
Index: phoneserver-1.0/config.h===================================================================--- phoneserver-1.0.orig/config.h	2007-02-12 12:15:42.000000000 +0100+++ phoneserver-1.0/config.h	2007-02-12 12:15:48.000000000 +0100@@ -22,7 +22,7 @@ /* serial port name */ #ifndef SERIAL_PORT //#define SERIAL_PORT "/dev/pts/0"        //ttyS1"-#define SERIAL_PORT "/dev/ttyS0"        //ttyS1"+#define SERIAL_PORT "/dev/ttyS1"        //ttyS1" #endif                          /*  */  /* serial port baudrate */Index: phoneserver-1.0/tapi.c===================================================================--- phoneserver-1.0.orig/tapi.c	2007-02-12 12:20:35.000000000 +0100+++ phoneserver-1.0/tapi.c	2007-02-12 14:15:04.000000000 +0100@@ -124,6 +124,7 @@ tel_err_t tapi_Init_SetSMSFormat (); tel_err_t tapi_Init_SetCPBS (); tel_err_t tapi_Init_SetCRC ();+tel_err_t tapi_Init_SetCPRIM (); tel_err_t tapi_Init_SetCREG (); tel_err_t tapi_Init_SetCNMI (); tel_err_t tapi_Init_SetCPMS ();@@ -289,12 +290,23 @@ static init_function init_func_table[] = {   tapi_Init_SoftReset,   tapi_Init_SetNoEcho,+// S0=0;Q0;V0+// X3;&C1;+CR=1;+CMOD=0;+FCLASS=0;+CSSN=0,1;+CCWA=1;+CMGF=0   tapi_Init_SetCharset,   tapi_Init_SetExtendedError,   tapi_Init_SetCRC,+#ifdef MAGICIAN_PLATFORM+//  AT+CGREG=1+//  AT+CUSD=1+//  AT+CMUT=0+//  AT%HTCCSQ=1+  tapi_Init_SetCPRIM,+#endif   tapi_Init_SetCREG,   tapi_Init_SetCLIP,+#ifndef MAGICIAN_PLATFORM   tapi_Init_SetCMER,+#endif   tapi_Init_SetCCWA,   tapi_Init_SetSMSFormat, //                      tapi_Init_SetCPBS,@@ -522,6 +534,10 @@   CommandStr =     AT_Builder_SetCmd ((Int8 *) CMD_CSCS, (Int8 *) "\"UCS2\"", (Int8 *) NULL); #endif+#ifdef MAGICIAN_PLATFORM+  CommandStr =+    AT_Builder_SetCmd ((Int8 *) CMD_CSCS, (Int8 *) "\"HEX\"", (Int8 *) NULL);+#endif   result = tapi_init_general (CommandStr);   return result; }@@ -559,6 +575,24 @@ }  /**+ *Initialize procedure -- Set HTC specific CPRIM parameter.+ */+tel_err_t+tapi_Init_SetCPRIM ()+{+  tel_err_t result;+  Int8 *CommandStr;++  /* AT%CPRIM="GMM","CONFIG MULTISLOT_CLASS=<10>" */+  CommandStr =+    AT_Builder_SetCmd ((Int8 *) "%CPRIM", (Int8 *) "\"GMM\"",+                       (Int8 *) "\"CONFIG MULTISLOT_CLASS=<10>\"", (Int8 *) NULL);+  result = tapi_init_general (CommandStr);+  return result;++}++/**  *Initialize procedure -- Set Network status code presentation.  */ tel_err_t@@ -688,10 +722,16 @@     AT_Builder_SetCmd ((Int8 *) CMD_CNMI, (Int8 *) "2", (Int8 *) "1",                        (Int8 *) "0", (Int8 *) "1", (Int8 *) "0", (Int8 *) NULL); #else+#ifdef MAGICIAN_PLATFORM+  CommandStr =+    AT_Builder_SetCmd ((Int8 *) CMD_CNMI, (Int8 *) "2", (Int8 *) "2",+                       (Int8 *) "2", (Int8 *) "1", (Int8 *) "0", (Int8 *) NULL);+#else   CommandStr =     AT_Builder_SetCmd ((Int8 *) CMD_CNMI, (Int8 *) "3", (Int8 *) "1",                        (Int8 *) "0", (Int8 *) "0", (Int8 *) "0", (Int8 *) NULL); #endif+#endif   result = tapi_init_general (CommandStr);   return result; }@@ -1054,6 +1094,50 @@        g_total_tapi += n_read;        }      */+    /* remove 0x2 (0x2) 0x16 [data] 0x2 frames */+    if (n_read > 0)+    {+      Int8 *src = g_inbuf_tapi + g_total_tapi;+      Int8 *end = src + n_read;+      Int8 *dst = src;+      n_read = 0;+      while (src < end)+      {+        /* strip initial 0x02's */+        while (src < end)+        {+          if (*src != 0x2)+            break;+          src++;+        }+        /* only consider AT channel (0x16) */+        if (*src == 0x16)+        {+          /* read until frame end (0x02) */+          src++;+          while (src < end)+          {+            if (*src == 0x2)+              break;+            *dst = *src;+            dst++; n_read++;+            src++;+          }+        }+        else+        {+          /* ignore until frame end (0x02) */+          src++;+          while (src < end)+          {+            if (*src == 0x2)+              break;+            src++;+          }+        }+        /* next packet */+      }+    }     if (n_read > 0)     {       g_total_tapi += n_read;@@ -2869,9 +2953,17 @@ xwrite (Int8 *d, UInt32 len) {   UInt32 res;-+  static Int8 frame[2] = { 0x2, 0x16 };   at_dprintf ("write: ", d, len); +  while ((res = serial_write (g_fd, frame, 2, -1)) == -1)+  {+    if (errno != EAGAIN)+    {+      perror ("gnokii I/O error ");+      return -1;+    }+  }   while (len)   {     res = serial_write (g_fd, d, len, -1);@@ -2890,6 +2982,14 @@       len -= res;     }   }+  while ((res = serial_write (g_fd, frame, 1, -1)) == -1)+  {+    if (errno != EAGAIN)+    {+      perror ("gnokii I/O error ");+      return -1;+    }+  }   return 0; } @@ -3029,9 +3129,11 @@  #ifndef T39_PLATFORM #ifndef CELLON_PLATFORM+#ifndef MAGICIAN_PLATFORM   g_print ("Please define platform\n"); #endif #endif+#endif   g_fd = serial_opendevice (SERIAL_PORT, FALSE, FALSE);   if (g_fd == -1)   {@@ -3046,6 +3148,11 @@   tel_ctx.cur_resp.cmd = g_ptr_array_new ();   isFree = TRUE; +#ifdef MAGICIAN_PLATFORM+  /* wait for "AT-Command Interpreter ready" */+  AT_GetResponse_Handler ();+#endif+   /* send register commands */    memset (g_inbuf_tapi, 0, ATCOMMAND_BUFFER_SIZE);Index: phoneserver-1.0/Makefile.am===================================================================--- phoneserver-1.0.orig/Makefile.am	2007-02-12 13:42:45.000000000 +0100+++ phoneserver-1.0/Makefile.am	2007-02-12 13:42:56.000000000 +0100@@ -3,7 +3,7 @@  INCLUDES = @DEPS_CFLAGS@ -DPREFIX=\"@prefix@\" -D_GNU_SOURCE -Wall \            -DDBUS_API_SUBJECT_TO_CHANGE \-           -DDEBUG -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -DCELLON_PLATFORM +           -DDEBUG -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -DMAGICIAN_PLATFORM  LDADD = @DEPS_LIBS@  @@ -15,4 +15,4 @@                      at-table.h file-lock.h phone-server-sms.h sms-phone.h types.h \                      phone-server-mul.h  phone-server-voc.h  sms-read-configure.h  util.h config.h -EXTRA_DIST = $(phoneserver_HEADER)                    \ No newline at end of file+EXTRA_DIST = $(phoneserver_HEADER)