r1821 - trunk/src/target/OM-2007/applications/openmoko-dialer/src

thomas at sita.openmoko.org thomas at sita.openmoko.org
Tue Apr 24 16:54:42 CEST 2007


Author: thomas
Date: 2007-04-24 16:54:40 +0200 (Tue, 24 Apr 2007)
New Revision: 1821

Removed:
   trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialergsm.c
   trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialergsm.h
Modified:
   trunk/src/target/OM-2007/applications/openmoko-dialer/src/Makefile.am
   trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.c
   trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-incoming.c
   trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-outgoing.c
   trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-talking.c
Log:
* Remove dialergsm.{c,h}, to be replaced by MokoGsmdConnection


Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/Makefile.am	2007-04-24 14:15:12 UTC (rev 1820)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/Makefile.am	2007-04-24 14:54:40 UTC (rev 1821)
@@ -14,7 +14,6 @@
 history.c\
 contacts.c\
 common.c\
-dialergsm.c\
 openmoko-dialer-window-history.c\
 openmoko-dialer-window-dialer.c\
 openmoko-dialer-window-outgoing.c\

Deleted: trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialergsm.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialergsm.c	2007-04-24 14:15:12 UTC (rev 1820)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialergsm.c	2007-04-24 14:54:40 UTC (rev 1821)
@@ -1,312 +0,0 @@
-/**
- * @file dialergsm.c
- * @brief this file includes the definitions of the functions which is called by the GUI app to perform
- * phone operations such as hangup, callout, answer. and the functions then calls the APIs of libgsmd, so 
- * this file is a bridge from GUI to libgsmd.
- *
- * Copyright (C) 2006 FIC-SH
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * @author Tony Guan (tonyguan at fic-sh.com.cn)
- * @date 2006-10-12
- */
-
-#include "dialergsm.h"
-#include "moko-dialer-includes.h"
-
-#include <pthread.h>
-#include <stdio.h>
-#include <sys/time.h>
-#include <string.h>
-
-//pthread_t thread;///<the gsm_monitor_thread thread handler
-
-static struct lgsm_handle *lgsmh;       ///< the handle of the libgsmd
-
-static GPollFD GPfd;
-
-
-/**
- * @brief monitor the connection with libgsmd, dispatch the event handler when needed.
- *
- * This function should be discarded once libgsmd evolves completely
- *
- * @param lgsmh struct lgsm_handle *,the handle of the libgsmd
- * @return 
- * @retval
- */
- /*
-
-    void *gsm_monitor_thread(struct lgsm_handle *lgsmh)
-    {
-    int rc;
-    char buf[STDIN_BUF_SIZE+1];
-    //char rbuf[STDIN_BUF_SIZE+1];
-    //int rlen = sizeof(rbuf);
-    fd_set readset;
-    //  lgsm_register_handler(lgsmh, GSMD_MSG_PASSTHROUGH, &pt_msghandler);
-
-    FD_ZERO(&readset);
-
-    while (1) {
-    int gsm_fd = lgsm_fd(lgsmh);
-    //          FD_SET(0, &readset);
-    FD_SET(gsm_fd, &readset);
-
-    rc = select(gsm_fd+1, &readset, NULL, NULL, NULL);
-    if (rc <= 0)        
-    break;
-    / we've received something on the gsmd socket, pass it on to the library 
-    rc = read(gsm_fd, buf, sizeof(buf));
-    if (rc <= 0) {
-    printf("ERROR reding from gsm_fd\n");
-    break;
-    }
-    rc = lgsm_handle_packet(lgsmh, buf, rc);
-    }
-
-
-    printf("you know what? i quit!");
-    pthread_exit(NULL);
-    }
-
-  */
-/**
- * @brief create the thread to monitor events from libgsmd
- *
- * 
- *
- * @param 
- * @return 
- * @retval -1 failed
- * @retval 0  success
- */
- /*
-    int gsm_start_loop()
-    {
-
-    //pthread_mutex_init(&mut,NULL);
-    memset(&thread, 0, sizeof(thread));          //comment1
-
-    if(pthread_create(&thread, NULL, gsm_monitor_thread, lgsmh) != 0)       //comment2
-    {  printf("failed to create libgsmd monitor thread\n");
-    return -1;
-    }
-
-    return 0;
-    }
-
-  */
-
-/**
- * @brief this is the handler for receiving passthrough responses 
- *
- * 
- *
- * @param lh struct lgsm_handle *, the libgsm handle
- * @param gmh struct gsmd_msg_hdr *, the data to passthrough
- * @return 
- * @retval -1 failed
- * @retval 0  success
- */
-
-static int
-pt_msghandler (struct lgsm_handle *lh, struct gsmd_msg_hdr *gmh)
-{
-  char *payload = (char *) gmh + sizeof (*gmh);
-  printf ("RSTR=`%s'\n", payload);
-  return 0;
-}
-
-
-
-/**
- * @brief take care the early initialization of libgsmd,this must be called before any physical phone operations such as dialing out.
- * @retval 1 failed, and the whole app will exit too.
- * @retval 0  success
- */
-
-int
-gsm_lgsm_start (GMainLoop * mainloop)
-{
-
-  char *pin = NULL;
-  lgsmh = lgsm_init (LGSMD_DEVICE_GSMD);
-  if (!lgsmh)
-  {
-    fprintf (stderr, "Can't connect to gsmd\n");
-    return -1;
-  }
-  gsm_pin_init (lgsmh);
-  event_init (lgsmh);
-  lgsm_register_handler (lgsmh, GSMD_MSG_PASSTHROUGH, &pt_msghandler);
-  lgsm_netreg_register (lgsmh, 0);
-
-  gsm_watcher_install (mainloop);
-  //gsm_start_loop();
-  return 0;
-
-}
-
-
-
-/**
- * @brief calls a number out
- * @param number the number to be called
- * @retval 0  success 
- * @retval other failed
- */
-int
-gsm_dial (const char *number)
-{
-  struct lgsm_addr addr;
-  addr.type = 129;
-  strncpy (addr.addr, number, g_utf8_strlen (number, -1));
-  addr.addr[g_utf8_strlen (number, -1)] = '\0';
-  return lgsm_voice_out_init (lgsmh, &addr);
-
-}
-
-/**
- * @brief accept an incoming call
- * @retval 0  success 
- * @retval other failed
- */
-int
-gsm_answer ()
-{
-  return lgsm_voice_in_accept (lgsmh);
-
-}
-
-/**
- * @brief hangup an outgoing call or incoming call or talking call
- * @retval 0  success 
- * @retval other failed
- */
-int
-gsm_hangup ()
-{
-
-  return lgsm_voice_hangup (lgsmh);
-
-}
-
-
-static gboolean
-gsm_watcher_prepare (GSource * source, gint * timeout)
-{
-  //DBG_ENTER();
-  *timeout = -1;
-
-  return FALSE;
-}
-
-static gboolean
-gsm_watcher_check (GSource * source)
-{
-
-  //DBG_ENTER();
-  //|G_IO_IN|G_IO_HUP|G_IO_ERR|G_IO_PRI;
-  if (GPfd.revents & (G_IO_IN | G_IO_PRI))
-  {
-
-    //GPfd.revents=0;
-    return TRUE;
-  }
-  else
-  {
-    //DBG_MESSAGE("FALSE");
-    return FALSE;
-  }
-
-}
-static gboolean
-gsm_watcher_dispatch (GSource * source,
-                      GSourceFunc callback, gpointer user_data)
-{
-
-
-  int rc;
-  char buf[STDIN_BUF_SIZE + 1];
-  int gsm_fd = lgsm_fd (lgsmh);
-  /* we've received something on the gsmd socket, pass it
-   * on to the library */
-
-  rc = read (gsm_fd, buf, sizeof (buf));
-  if (rc <= 0)
-  {
-    DBG_MESSAGE ("ERROR reding from gsm_fd");
-    return FALSE;
-  }
-  else
-  {
-    rc = lgsm_handle_packet (lgsmh, buf, rc);
-  }
-  return TRUE;
-}
-
-void
-gsm_watcher_install (GMainLoop * mainloop)
-{
-
-  static GSourceFuncs gsm_watcher_funcs = {
-    gsm_watcher_prepare,
-    gsm_watcher_check,
-    gsm_watcher_dispatch,
-    NULL
-  };
-  /* FIXME: we never unref the watcher. */
-  GSource *gsm_watcher = g_source_new (&gsm_watcher_funcs, sizeof (GSource));
-  GPfd.fd = lgsm_fd (lgsmh);
-  GPfd.events = G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI;
-  GPfd.revents = 0;
-
-  g_source_add_poll (gsm_watcher, &GPfd);
-
-//  DBG_MESSAGE ("ATACH");
-  g_source_attach (gsm_watcher, NULL);
-//  DBG_MESSAGE ("ATACH OUT");
-
-  return;
-
-}
-
-void
-gsm_dtmf_send (char dtmf)
-{
-  DBG_MESSAGE ("lgsm_voice_dtmf");
-  lgsm_voice_dtmf (lgsmh, dtmf);
-}
-
-#define PIN_SIZE 32
-
-static int
-gsm_pin_handler (struct lgsm_handle *lh, int evt,
-                 struct gsmd_evt_auxdata *aux)
-{
-
-  int rc;
-
-  printf ("EVENT: PIN request (type=%u) ", aux->u.pin.type);
-
-  gsm_pin_require (lh);
-
-
-  return 0;
-}
-
-int
-gsm_pin_init (struct lgsm_handle *lh)
-{
-  return lgsm_evt_handler_register (lh, GSMD_EVT_PIN, &gsm_pin_handler);
-}

Deleted: trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialergsm.h
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialergsm.h	2007-04-24 14:15:12 UTC (rev 1820)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/dialergsm.h	2007-04-24 14:54:40 UTC (rev 1821)
@@ -1,115 +0,0 @@
-/**
- * @file dialergsm.h
- * @brief this file includes the definitions of the functions which is called by the GUI app to perform
- * phone operations such as hangup, callout, answer. and the functions then calls the APIs of libgsmd, so 
- * this file is a bridge from GUI to libgsmd.
- *
- * Copyright (C) 2006 FIC-SH
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * @author Tony Guan (tonyguan at fic-sh.com.cn)
- * @date 2006-10-12
- */
-
-#ifndef _DIALERGSM_H
-#define _DIALERGSM_H
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include <libgsmd/libgsmd.h>
-#include <libgsmd/voicecall.h>
-#include <libgsmd/misc.h>
-//#include "pin.h"
-#include "event.h"
-#include <glib/gmain.h>
-#include <glib/giochannel.h>
-/*
-int event_init(struct lgsm_handle *lh);
-
-int shell_main(struct lgsm_handle *lgsmh);
-	
-int pin_init(struct lgsm_handle *lh, const char *pin_preset);
-*/
-
-//#include "lgsm_internals.h"
-
-//#include "dialer.h"
-
-#define STDIN_BUF_SIZE	1024
-/**
- * @brief create the thread to monitor events from libgsmd
- *
- * 
- *
- * @param 
- * @return 
- * @retval -1 failed
- * @retval 0  success
- */
-  int gsm_start_loop ();
-/**
- * @brief take care the early initialization of libgsmd,this must be called before any physical phone operations such as dialing out.
- * @retval 1 failed, and the whole app will exit too.
- * @retval 0  success
- */
-  int gsm_lgsm_start (GMainLoop * mainloop);
-/**
- * @brief hangup an outgoing call or incoming call or talking call
- * @retval 0  success 
- * @retval other failed
- */
-  int gsm_hangup ();
-
-/**
- * @brief accept an incoming call
- * @retval 0  success 
- * @retval other failed
- */
-  int gsm_answer ();
-/**
- * @brief calls a number out
- * @param number the number to be called
- * @retval 0  success 
- * @retval other failed
- */
-  int gsm_dial (const char *number);
-/**
- * @brief monitor the connection with libgsmd, dispatch the event handler when needed.
- *
- * This function should be discarded once libgsmd evolves completely
- *
- * @param lgsmh struct lgsm_handle *,the handle of the libgsmd
- * @return 
- * @retval
- */
-
-  void gsm_pin_require ();
-
-  void *gsm_monitor_thread (struct lgsm_handle *lgsmh);
-
-
-  void gsm_watcher_install (GMainLoop * mainloop);
-  void gsm_dtmf_send (char dtmf);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif                          /* _DIALERGSM_H */

Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.c	2007-04-24 14:15:12 UTC (rev 1820)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-main.c	2007-04-24 14:54:40 UTC (rev 1821)
@@ -36,7 +36,7 @@
 #include "contacts.h"
 #include  "history.h"
 #include "error.h"
-#include "dialergsm.h"
+#include "errno.h"
 #include "openmoko-dialer-main.h"
 #include "openmoko-dialer-window-dialer.h"
 #include "openmoko-dialer-window-talking.h"
@@ -166,7 +166,10 @@
 {
 
   MOKO_DIALER_APP_DATA *appdata = moko_get_app_data ();
-  gsm_hangup ();
+  /* TODO: MokoGsmdConnection->hangup 
+   * gsm_hangup ();
+   */
+
   if (appdata->window_talking)
     gtk_widget_hide (appdata->window_talking);
   if (appdata->window_outgoing)
@@ -337,16 +340,9 @@
     handle_sigusr1 (SIGUSR1);
   }
 
-//from now on we will not use multithreads.
-  gsm_lgsm_start (mainloop);
+  gtk_main ();
 
-//for debug only>>
-//gsm_incoming_call("13917209523");
-//<<for debug only
 
-  g_main_loop_run (mainloop);
-
-
 //release everything    
   contact_release_contact_list (&(p_dialer_data->g_contactlist));
 

Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-incoming.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-incoming.c	2007-04-24 14:15:12 UTC (rev 1820)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-incoming.c	2007-04-24 14:54:40 UTC (rev 1821)
@@ -36,23 +36,26 @@
 #include "openmoko-dialer-window-incoming.h"
 #include "openmoko-dialer-window-talking.h"
 #include "openmoko-dialer-window-history.h"
-#include "dialergsm.h"
 #include "history.h"
 
void 
 cb_answer_button_clicked (GtkButton * button,
                           MOKO_DIALER_APP_DATA * appdata) 
 {
-  
DBG_ENTER ();
-  

appdata->g_state.callstate = STATE_TALKING;
-  
gsm_answer ();
-  

gtk_widget_hide (appdata->window_incoming);
-  
-//transfer the contact info
-    window_talking_prepare (appdata);
-  


gtk_widget_show (appdata->window_talking);
+  DBG_ENTER ();
+  appdata->g_state.callstate = STATE_TALKING;
+  /* TODO: MokoGsmdConnection->answer
+   * gsm_answer ();
+   */
+
+  gtk_widget_hide (appdata->window_incoming);
+
+  //transfer the contact info
+   window_talking_prepare (appdata);
+  gtk_widget_show (appdata->window_talking);
   

DBG_LEAVE ();
-
} 

void 
+} 
 
+void
 cb_ignore_button_clicked (GtkButton * button,
                           MOKO_DIALER_APP_DATA * appdata) 
 {
@@ -65,13 +68,16 @@
 cb_reject_button_clicked (GtkButton * button,
                           MOKO_DIALER_APP_DATA * appdata) 
 {
-  
DBG_ENTER ();
-  
gsm_hangup ();
-  
appdata->g_state.callstate = STATE_REJECTED;
-  
gtk_widget_hide (appdata->window_incoming);
-  
DBG_LEAVE ();
-
} 

void 
+  DBG_ENTER ();
+  /* TODO: MokoGsmdConnection->hangup
+   * gsm_hangup ();
+   */
+  appdata->g_state.callstate = STATE_REJECTED;
+  gtk_widget_hide (appdata->window_incoming);
+  DBG_LEAVE ();
+}
 
+void
 window_incoming_prepare (MOKO_DIALER_APP_DATA * appdata) 
 {
   
if (!appdata)

Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-outgoing.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-outgoing.c	2007-04-24 14:15:12 UTC (rev 1820)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-outgoing.c	2007-04-24 14:54:40 UTC (rev 1821)
@@ -36,7 +36,6 @@
 #include "openmoko-dialer-window-outgoing.h"
 #include "openmoko-dialer-window-history.h"
 #include "openmoko-dialer-window-talking.h"
-#include "dialergsm.h"
 
 /* function declerations */
 void window_outgoing_setup_timer (MOKO_DIALER_APP_DATA * appdata);
@@ -80,7 +79,9 @@
 
   appdata->g_state.callstate = STATE_CALLING;
   appdata->g_state.historytype = OUTGOING;
-  gsm_dial (appdata->g_peer_info.number);
+  /* TOOD: MokoGsmdConnection->dial
+   * gsm_dial (appdata->g_peer_info.number);
+   */
 
   DBG_LEAVE ();
 }
@@ -89,7 +90,9 @@
 cb_cancel_button_clicked (GtkButton * button, MOKO_DIALER_APP_DATA * appdata)
 {
   DBG_ENTER ();
-  gsm_hangup ();
+  /* TODO: MokoGsmdConnection->hangup
+   * gsm_hangup ();
+   */
   appdata->g_state.callstate = STATE_FAILED;
   DBG_TRACE ();
   gtk_widget_hide (appdata->window_outgoing);
@@ -239,8 +242,10 @@
   //DBG_TRACE ();
   appdata->g_state.historytype = OUTGOING;
   //DBG_TRACE ();
-  int retv = gsm_dial (appdata->g_peer_info.number);
-  DBG_MESSAGE ("GSM_DIAL returns %d", retv);
+  /* TODO: MokoGsmdConnection->dial
+   * int retv = gsm_dial (appdata->g_peer_info.number);
+   * DBG_MESSAGE ("GSM_DIAL returns %d", retv);
+   */
   //DBG_LEAVE ();
 }
 

Modified: trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-talking.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-talking.c	2007-04-24 14:15:12 UTC (rev 1820)
+++ trunk/src/target/OM-2007/applications/openmoko-dialer/src/openmoko-dialer-window-talking.c	2007-04-24 14:54:40 UTC (rev 1821)
@@ -36,7 +36,6 @@
 #include "moko-dialer-status.h"
 #include "openmoko-dialer-window-talking.h"
 #include "openmoko-dialer-window-history.h"
-#include "dialergsm.h"
 
 void
 openmoko_wheel_press_left_up_cb (GtkWidget * widget,
@@ -112,7 +111,9 @@
 cb_tool_button_hangup_clicked (GtkButton * button,
                                MOKO_DIALER_APP_DATA * appdata)
 {
-  gsm_hangup ();
+  /* TODO: MokoGsmdConnection->hangup
+   * gsm_hangup ();
+   */
   gtk_widget_hide (appdata->window_talking);
 
 }
@@ -132,7 +133,9 @@
   moko_dialer_textview_insert (moko_dtmf_text_view, input);
 
 
-  gsm_dtmf_send (input[0]);
+  /* TODO: MokoGsmdConnection->dtmf_send
+   * gsm_dtmf_send (input[0]);
+   */
 //lgsm_voice_dtmf(lgsmh, buf[1]);
 
 }





More information about the commitlog mailing list