Send commitlog mailing list submissions to
[EMAIL PROTECTED]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:
1. r1731 - in trunk/src/target/OM-2007/openmoko-libs: .
libmokojournal/src libmokojournal/tests ([EMAIL PROTECTED])
2. r1732 - in trunk/src/target/OM-2007/examples: .
openmoko-gsmd-demo openmoko-gsmd-demo/src ([EMAIL PROTECTED])
3. r1733 - in trunk/src/target/OM-2007: devel/qmake
openmoko-libs openmoko-libs/libmokogsmd ([EMAIL PROTECTED])
--- Begin Message ---
Author: dodji
Date: 2007-04-12 13:47:32 +0200 (Thu, 12 Apr 2007)
New Revision: 1731
Added:
trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/test-delete-uid.c
Modified:
trunk/src/target/OM-2007/openmoko-libs/ChangeLog
trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.c
trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.h
trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/Makefile.am
trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/test-delete.c
Log:
Support entry removal by UID
* openmoko-libs/libmokojournal/src/moko-journal.c,h:
(moko_journal_remove_entry_by_uid): added this new entry point.
(moko_journal_entry_get_uid): ditto
* openmoko-libs/libmokojournal/tests/test-delete-uid.c: added
this to test/debug removal by uid.
Modified: trunk/src/target/OM-2007/openmoko-libs/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/ChangeLog 2007-04-12 09:21:34 UTC
(rev 1730)
+++ trunk/src/target/OM-2007/openmoko-libs/ChangeLog 2007-04-12 11:47:32 UTC
(rev 1731)
@@ -1,5 +1,13 @@
2007-04-12 Dodji Seketeli <[EMAIL PROTECTED]>
+ * openmoko-libs/libmokojournal/src/moko-journal.c,h:
+ (moko_journal_remove_entry_by_uid): added this new entry point.
+ (moko_journal_entry_get_uid): ditto
+ * openmoko-libs/libmokojournal/tests/test-delete-uid.c: added
+ this to test/debug removal by uid.
+
+2007-04-12 Dodji Seketeli <[EMAIL PROTECTED]>
+
* openmoko-libs/libmokojournal/src/moko-journal.[c|h]:
change moko_j_entry* into moko_journal_entry*,
MokoJEntry, into MokoJournalEntry, etc.
Modified:
trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.c
2007-04-12 09:21:34 UTC (rev 1730)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.c
2007-04-12 11:47:32 UTC (rev 1731)
@@ -686,6 +686,37 @@
}
/**
+ * moko_journal_remove_entry_by_uid:
+ * @journal: the current instance of journal
+ * @uid: the uid of the journal entry to remove
+ *
+ * Remove the journal entry that has a given UID.
+ *
+ * Return value: TRUE in case of success, FALSE otherwise
+ */
+gboolean
+moko_journal_remove_entry_by_uid (MokoJournal *a_journal,
+ const gchar* a_uid)
+{
+ int i=0 ;
+ MokoJournalEntry *entry=NULL ;
+
+ g_return_val_if_fail (a_journal, FALSE) ;
+ g_return_val_if_fail (a_journal->entries, FALSE) ;
+ g_return_val_if_fail (a_uid, FALSE) ;
+
+ for (i=0 ; i < a_journal->entries->len ; ++i)
+ {
+ entry = g_array_index (a_journal->entries, MokoJournalEntry*, i) ;
+ if (entry && entry->uid && !strcmp (entry->uid, a_uid))
+ {
+ return moko_journal_remove_entry_at (a_journal, i) ;
+ }
+ }
+ return FALSE ;
+}
+
+/**
* moko_journal_write_to_storage:
* @journal: the journal to save to storage
*
@@ -1055,6 +1086,24 @@
}
/**
+ * moko_journal_entry_get_uid:
+ * @entry: the current instance of journal entry
+ *
+ * Gets the UID of the current entry. This UID is non NULL if and
+ * only if the entry has been persistet at least once.
+ *
+ * Return value: the UID in case the entry has been persisted at least once,
+ * NULL otherwise. The client code must *NOT* free the returned string.
+ */
+const gchar*
+moko_journal_entry_get_uid (MokoJournalEntry *a_entry)
+{
+ g_return_val_if_fail (a_entry, NULL) ;
+
+ return a_entry->uid ;
+}
+
+/**
* moko_journal_entry_get_contact_uid:
* @entry: the current instance of journal entry
*
Modified:
trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.h
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.h
2007-04-12 09:21:34 UTC (rev 1730)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokojournal/src/moko-journal.h
2007-04-12 11:47:32 UTC (rev 1731)
@@ -114,12 +114,26 @@
* @index: the index to remove the entry from
*
* Remove a journal entry from index #index
+ *
+ * Return value: TRUE in case of success, FALSE otherwise
*/
gboolean moko_journal_remove_entry_at (MokoJournal *journal,
guint index) ;
/**
- * moko_journal_weite_to_storage:
+ * moko_journal_remove_entry_by_uid:
+ * @journal: the current instance of journal
+ * @uid: the uid of the journal entry to remove
+ *
+ * Remove the journal entry that has a given UID.
+ *
+ * Return value: TRUE in case of success, FALSE otherwise
+ */
+gboolean moko_journal_remove_entry_by_uid (MokoJournal *journal,
+ const gchar* uid) ;
+
+/**
+ * moko_journal_write_to_storage:
* @journal: the journal to save to storage
*
* Saves the journal to persistent storage (e.g disk) using the
@@ -188,6 +202,18 @@
MokoJournalEntryType type) ;
/**
+ * moko_journal_entry_get_uid:
+ * @entry: the current instance of journal entry
+ *
+ * Gets the UID of the current entry. This UID is non NULL if and
+ * only if the entry has been persistet at least once.
+ *
+ * Return value: the UID in case the entry has been persisted at least once,
+ * NULL otherwise. The client code must *NOT* free the returned string.
+ */
+const gchar* moko_journal_entry_get_uid (MokoJournalEntry *entry) ;
+
+/**
* moko_journal_entry_get_contact_uid:
* @entry: the current instance of journal entry
*
Modified:
trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/Makefile.am
2007-04-12 09:21:34 UTC (rev 1730)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/Makefile.am
2007-04-12 11:47:32 UTC (rev 1731)
@@ -1,4 +1,4 @@
-noinst_PROGRAMS=testcreate testdelete
+noinst_PROGRAMS=testcreate testdelete testdeleteuid
testcreate_SOURCES=test-create.c
[EMAIL PROTECTED]@ $(top_srcdir)/libmokojournal/src/libmokojournal.la
@@ -6,4 +6,8 @@
testdelete_SOURCES=test-delete.c
[EMAIL PROTECTED]@ $(top_srcdir)/libmokojournal/src/libmokojournal.la
+testdeleteuid_SOURCES=test-delete-uid.c
[EMAIL PROTECTED]@ $(top_srcdir)/libmokojournal/src/libmokojournal.la
+
INCLUDES= -I $(top_srcdir)/libmokojournal/src
+
Copied:
trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/test-delete-uid.c
(from rev 1730,
trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/test-delete.c)
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/test-delete.c
2007-04-12 09:21:34 UTC (rev 1730)
+++
trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/test-delete-uid.c
2007-04-12 11:47:32 UTC (rev 1731)
@@ -0,0 +1,94 @@
+/* vi: set sw=2: */
+/*
+ * Copyright (C) 2007 by OpenMoko, Inc.
+ * Written by OpenedHand Ltd <[EMAIL PROTECTED]>
+ * All Rights Reserved
+ *
+ * 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 of the License, 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.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#include <glib-object.h>
+#include "moko-journal.h"
+
+int
+main ()
+{
+ MokoJournal *journal=NULL ;
+ MokoJournalEntry *entry=NULL ;
+ int result=-1 ;
+
+ g_type_init () ;
+
+ /*open the journal*/
+ journal = moko_journal_open_default () ;
+ g_return_val_if_fail (journal, -1) ;
+
+ if (!moko_journal_load_from_storage (journal))
+ {
+ g_warning ("failed to load journal from storage\n") ;
+ goto out ;
+ }
+ g_message ("initial number of journal entries: %d\n",
+ moko_journal_get_nb_entries (journal)) ;
+
+ /*remove all entries from journal starting from the oldest one*/
+ while (moko_journal_get_nb_entries (journal) > 0)
+ {
+ entry = NULL ;
+ /*get the oldest entry*/
+ if (!moko_journal_get_entry_at (journal, 0, &entry) || !entry)
+ {
+ g_message ("failed to get entry at index 0\n") ;
+ goto out ;
+ }
+ /*make sure it has an UID*/
+ if (!moko_journal_entry_get_uid (entry))
+ {
+ g_message ("error: came accross an entry without UID\n") ;
+ goto out ;
+ }
+ /*remove the entry from the journal, using its UID*/
+ if (!moko_journal_remove_entry_by_uid
+ (journal,
+ moko_journal_entry_get_uid (entry)))
+ {
+ g_message ("failed to remove entry of UID '%s' from journal\n",
+ moko_journal_entry_get_uid (entry)) ;
+ goto out ;
+ }
+ }
+ /*write the modifications we did, back to persistent storage*/
+ if (!moko_journal_write_to_storage (journal))
+ {
+ g_message ("failed to write to storage\n") ;
+ goto out ;
+ }
+
+ if (moko_journal_get_nb_entries (journal) != 0)
+ {
+ g_message ("test failed, we still have %d entries left\n",
+ moko_journal_get_nb_entries (journal)) ;
+ goto out ;
+ }
+
+ /*if we reached this place, the test is prolly successful*/
+ g_message ("test succeeded") ;
+ result = 0 ;
+
+out:
+ if (journal)
+ moko_journal_close (journal) ;
+
+ return result ;
+}
Modified:
trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/test-delete.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/test-delete.c
2007-04-12 09:21:34 UTC (rev 1730)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokojournal/tests/test-delete.c
2007-04-12 11:47:32 UTC (rev 1731)
@@ -29,6 +29,7 @@
g_type_init () ;
+ /*open the journal*/
journal = moko_journal_open_default () ;
g_return_val_if_fail (journal, -1) ;
--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-04-12 23:52:30 +0200 (Thu, 12 Apr 2007)
New Revision: 1732
Added:
trunk/src/target/OM-2007/examples/openmoko-gsmd-demo/
trunk/src/target/OM-2007/examples/openmoko-gsmd-demo/openmoko-gsmd-demo.pro
trunk/src/target/OM-2007/examples/openmoko-gsmd-demo/src/
trunk/src/target/OM-2007/examples/openmoko-gsmd-demo/src/demo-main.c
Modified:
trunk/src/target/OM-2007/examples/examples.pro
Log:
examples: add openmoko-gsmd-demo
Modified: trunk/src/target/OM-2007/examples/examples.pro
===================================================================
--- trunk/src/target/OM-2007/examples/examples.pro 2007-04-12 11:47:32 UTC
(rev 1731)
+++ trunk/src/target/OM-2007/examples/examples.pro 2007-04-12 21:52:30 UTC
(rev 1732)
@@ -4,6 +4,9 @@
openmoko-stylus-demo \
openmoko-finger-demo \
openmoko-panel-demo-simple \
- openmoko-panel-demo
+ openmoko-panel-demo \
+ openmoko-dialog-demo \
+ openmoko-gsmd-demo
+
Added:
trunk/src/target/OM-2007/examples/openmoko-gsmd-demo/openmoko-gsmd-demo.pro
===================================================================
--- trunk/src/target/OM-2007/examples/openmoko-gsmd-demo/openmoko-gsmd-demo.pro
2007-04-12 11:47:32 UTC (rev 1731)
+++ trunk/src/target/OM-2007/examples/openmoko-gsmd-demo/openmoko-gsmd-demo.pro
2007-04-12 21:52:30 UTC (rev 1732)
@@ -0,0 +1,5 @@
+TEMPLATE = app
+SOURCES += src/demo-main.c
+MOKOCONFIG = mokoui mokogsmd
+
+include ( $(OPENMOKODIR)/devel/qmake/openmoko-include.pro )
Added: trunk/src/target/OM-2007/examples/openmoko-gsmd-demo/src/demo-main.c
===================================================================
--- trunk/src/target/OM-2007/examples/openmoko-gsmd-demo/src/demo-main.c
2007-04-12 11:47:32 UTC (rev 1731)
+++ trunk/src/target/OM-2007/examples/openmoko-gsmd-demo/src/demo-main.c
2007-04-12 21:52:30 UTC (rev 1732)
@@ -0,0 +1,125 @@
+/*
+ * Gsmd-Demo -- OpenMoko Demo Application
+ *
+ * Authored by Michael 'Mickey' Lauer <[EMAIL PROTECTED]>
+ *
+ * Copyright (C) 2007 OpenMoko, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Public License as published by
+ * the Free Software Foundation; version 2.1 of the license.
+ *
+ * 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 Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#include <libmokoui/moko-application.h>
+#include <libmokoui/moko-finger-tool-box.h>
+#include <libmokoui/moko-finger-window.h>
+#include <libmokoui/moko-finger-wheel.h>
+
+#include <libmokogsmd/moko-gsmd-connection.h>
+
+#include <gtk/gtkalignment.h>
+#include <gtk/gtkbutton.h>
+#include <gtk/gtkhbox.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkmain.h>
+#include <gtk/gtkmenu.h>
+#include <gtk/gtktogglebutton.h>
+#include <gtk/gtkvbox.h>
+
+static GtkVBox* vbox = NULL;
+static MokoFingerToolBox* tools = NULL;
+
+static MokoGsmdConnection* gsm = NULL;
+
+static GtkLabel* network;
+static GtkLabel* signal;
+static GtkLabel* status;
+
+void cb_orange_button_clicked( GtkButton* button, MokoFingerWindow* window )
+{
+ g_debug( "openmoko-gsmd-demo: orange button clicked" );
+}
+
+void cb_dialer_button_clicked( GtkButton* button, MokoFingerWindow* window )
+{
+ g_debug( "openmoko-gsmd-demo: dialer button clicked" );
+}
+
+void cb_black_button_clicked( GtkButton* button, MokoFingerWindow* window )
+{
+ g_debug( "openmoko-gsmd-demo: black button clicked" );
+}
+
+int main( int argc, char** argv )
+{
+ g_debug( "openmoko-gsmd-demo starting up" );
+ /* Initialize GTK+ */
+ gtk_init( &argc, &argv );
+
+ /* application object */
+ MokoApplication* app = MOKO_APPLICATION(moko_application_get_instance());
+ g_set_application_name( "Gsmd-Demo" );
+
+ /* main window */
+ MokoFingerWindow* window = MOKO_FINGER_WINDOW(moko_finger_window_new());
+
+ /* application menu */
+ GtkMenu* appmenu = GTK_MENU(gtk_menu_new());
+ GtkMenuItem* closeitem = GTK_MENU_ITEM(gtk_menu_item_new_with_label(
"Close" ));
+ g_signal_connect( G_OBJECT(closeitem), "activate",
G_CALLBACK(gtk_main_quit), NULL );
+ gtk_menu_shell_append( appmenu, closeitem );
+ moko_finger_window_set_application_menu( window, appmenu );
+
+ /* connect close event */
+ g_signal_connect( G_OBJECT(window), "delete_event",
G_CALLBACK(gtk_main_quit), NULL );
+
+ /* contents */
+ vbox = gtk_vbox_new( TRUE, 0 );
+ network = gtk_label_new( "<not yet registered>" );
+ signal = gtk_label_new( "<signal strength>" );
+ status = gtk_label_new( "<unnown>" );
+ GtkLabel* label2 = gtk_label_new( "Orange button powers on, \nDialer
button registeres,\nBlack button powers off\n \n \n" );
+ GtkHBox* hbox = gtk_hbox_new( TRUE, 0 );
+
+ GtkButton* button1 = gtk_button_new();
+ g_signal_connect( G_OBJECT(button1), "clicked",
G_CALLBACK(cb_orange_button_clicked), window );
+ gtk_widget_set_name( GTK_WIDGET(button1), "mokofingerbutton-orange" );
+ gtk_box_pack_start( GTK_BOX(hbox), GTK_WIDGET(button1), TRUE, TRUE, 5 );
+
+ GtkButton* button2 = gtk_button_new();
+ //FIXME toggle buttons look odd... needs working on styling
+ //gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (button2), TRUE);
+ g_signal_connect( G_OBJECT(button2), "clicked",
G_CALLBACK(cb_dialer_button_clicked), window );
+ gtk_widget_set_name( GTK_WIDGET(button2), "mokofingerbutton-dialer" );
+ gtk_box_pack_start( GTK_BOX(hbox), GTK_WIDGET(button2), TRUE, TRUE, 5 );
+
+ GtkButton* button3 = gtk_button_new();
+ g_signal_connect( G_OBJECT(button3), "clicked",
G_CALLBACK(cb_black_button_clicked), window );
+ gtk_widget_set_name( GTK_WIDGET(button3), "mokofingerbutton-black" );
+ gtk_box_pack_start( GTK_BOX(hbox), GTK_WIDGET(button3), TRUE, TRUE, 5 );
+
+ gtk_box_pack_start( vbox, GTK_WIDGET(network), FALSE, FALSE, 0 );
+ gtk_box_pack_start( vbox, GTK_WIDGET(signal), FALSE, FALSE, 0 );
+ gtk_box_pack_start( vbox, GTK_WIDGET(status), FALSE, FALSE, 0 );
+ gtk_box_pack_start( vbox, GTK_WIDGET(hbox), TRUE, TRUE, 0 );
+ gtk_box_pack_start( vbox, GTK_WIDGET(label2), FALSE, FALSE, 0 );
+
+ moko_finger_window_set_contents( window, GTK_WIDGET(vbox) );
+
+ gsm = moko_gsmd_connection_new();
+
+ /* show everything and run main loop */
+ gtk_widget_show_all( GTK_WIDGET(window) );
+ g_debug( "openmoko-gsmd-demo entering main loop" );
+ gtk_main();
+ g_debug( "openmoko-gsmd-demo left main loop" );
+
+ return 0;
+}
Property changes on:
trunk/src/target/OM-2007/examples/openmoko-gsmd-demo/src/demo-main.c
___________________________________________________________________
Name: svn:eol-style
+ native
--- End Message ---
--- Begin Message ---
Author: mickey
Date: 2007-04-12 23:54:34 +0200 (Thu, 12 Apr 2007)
New Revision: 1733
Added:
trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/
trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/Makefile.am
trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/libmokogsmd.pro
trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/moko-gsmd-connection.c
trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/moko-gsmd-connection.h
Modified:
trunk/src/target/OM-2007/devel/qmake/openmoko-include.pro
trunk/src/target/OM-2007/openmoko-libs/Makefile.am
trunk/src/target/OM-2007/openmoko-libs/openmoko-libs.pro
Log:
openmoko-libs: add skeleton for MokoGsmdConnection class
Modified: trunk/src/target/OM-2007/devel/qmake/openmoko-include.pro
===================================================================
--- trunk/src/target/OM-2007/devel/qmake/openmoko-include.pro 2007-04-12
21:52:30 UTC (rev 1732)
+++ trunk/src/target/OM-2007/devel/qmake/openmoko-include.pro 2007-04-12
21:54:34 UTC (rev 1733)
@@ -33,6 +33,12 @@
LIBS += -lmokocore -L$(OPENMOKODIR)/lib
}
+mokogsmd {
+ INCLUDEPATH += $(OPENMOKODIR)/openmoko-libs
+ PKGCONFIG += libgsmd
+ LIBS += -lmokogsmd -L$(OPENMOKODIR)/lib
+}
+
mokoui {
INCLUDEPATH += $(OPENMOKODIR)/openmoko-libs
PKGCONFIG += gtk+-2.0
@@ -49,6 +55,11 @@
LIBS += -lmokonet -L$(OPENMOKODIR)/lib
}
+mokojournal {
+ INCLUDEPATH += $(OPENMOKODIR)/openmoko-libs
+ LIBS += -lmokojournal -L$(OPENMOKODIR)/lib
+}
+
# handle pkgconfig for CFLAGS, CXXFLAGS and LIBS already handled by qmake
for(PKGCONFIG_LIB, $$list($$unique(PKGCONFIG))) {
# QMAKE_CXXFLAGS += $$system(pkg-config --cflags $$PKGCONFIG_LIB)
Modified: trunk/src/target/OM-2007/openmoko-libs/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/Makefile.am 2007-04-12 21:52:30 UTC
(rev 1732)
+++ trunk/src/target/OM-2007/openmoko-libs/Makefile.am 2007-04-12 21:54:34 UTC
(rev 1733)
@@ -1,4 +1,3 @@
-# SUBDIRS = libmokocore libmokoui libmokopim libmokonet
SUBDIRS = libmokoui libmokojournal data
pcdata_DATA= openmoko-libs.pc
Added: trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/Makefile.am
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/Makefile.am
2007-04-12 21:52:30 UTC (rev 1732)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/Makefile.am
2007-04-12 21:54:34 UTC (rev 1733)
@@ -0,0 +1,13 @@
+lib_LTLIBRARIES=libmokogsmd.la
+
+public_headers=moko-gsmd-connection.h
+sources=moko-gsmd-connection.c
+
+libmokogsmd_la_SOURCES= $(sources) $(public_headers)
+libmokogsmd_la_LIBADD=
+libmokogsmd_la_LDFLAGS= -version-info 0:0:0
+AM_CFLAGS = -Wall -pedantic -std=c99
+
+libmokogsmdheadersdir=$(includedir)/openmoko-libs/libmokogsmd
+libmokogsmdheaders_DATA=$(public_headers)
+
Added: trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/libmokogsmd.pro
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/libmokogsmd.pro
2007-04-12 21:52:30 UTC (rev 1732)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/libmokogsmd.pro
2007-04-12 21:54:34 UTC (rev 1733)
@@ -0,0 +1,10 @@
+TEMPLATE = lib
+TARGET = mokogsmd
+
+HEADERS += moko-gsmd-connection.h
+SOURCES += moko-gsmd-connection.c
+
+PKGCONFIG += glib-2.0 libgsmd
+
+include ( $(OPENMOKODIR)/devel/qmake/openmoko-include.pro )
+
Added: trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/moko-gsmd-connection.c
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/moko-gsmd-connection.c
2007-04-12 21:52:30 UTC (rev 1732)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/moko-gsmd-connection.c
2007-04-12 21:54:34 UTC (rev 1733)
@@ -0,0 +1,102 @@
+/* moko-gsmd-connection.c
+ *
+ * Authored By Michael 'Mickey' Lauer <[EMAIL PROTECTED]>
+ * Copyright (C) 2007 OpenMoko, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2 of the license.
+ *
+ * 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 Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date: 2006/12/21 18:03:04 $) [$Author: mickey $]
+ */
+
+#include "moko-gsmd-connection.h"
+
+#include <libgsmd/libgsmd.h>
+
+#undef DEBUG_THIS_FILE
+#define DEBUG_THIS_FILE
+
+#ifdef DEBUG_THIS_FILE
+#define moko_debug(fmt,...) g_debug(fmt,##__VA_ARGS__)
+#else
+#define moko_debug(fmt,...)
+#endif
+
+G_DEFINE_TYPE (MokoGsmdConnection, moko_gsmd_connection, G_TYPE_OBJECT);
+
+#define GSMD_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o),
MOKO_TYPE_GSMD_CONNECTION, MokoGsmdConnectionPrivate))
+
+typedef struct _MokoGsmdConnectionPrivate
+{
+ struct lgsm_handle* handle;
+ GPollFD fd;
+} MokoGsmdConnectionPrivate;
+
+/* parent class pointer */
+GObjectClass* parent_class = NULL;
+
+/* forward declarations */
+/* ... */
+
+static void
+moko_gsmd_connection_dispose(GObject* object)
+{
+ if (G_OBJECT_CLASS (moko_gsmd_connection_parent_class)->dispose)
+ G_OBJECT_CLASS (moko_gsmd_connection_parent_class)->dispose (object);
+}
+
+static void
+moko_gsmd_connection_finalize(GObject* object)
+{
+ moko_debug( "finalize" );
+ //TODO remove source from mainloop and cleanup w/ libgsmd
+ G_OBJECT_CLASS (moko_gsmd_connection_parent_class)->finalize (object);
+}
+
+static void
+moko_gsmd_connection_class_init(MokoGsmdConnectionClass* klass)
+{
+ /* hook parent */
+ GObjectClass* object_class = G_OBJECT_CLASS (klass);
+ parent_class = g_type_class_peek_parent(klass);
+
+ /* add private */
+ g_type_class_add_private (klass, sizeof(MokoGsmdConnectionPrivate));
+
+ /* hook destruction */
+ object_class->dispose = moko_gsmd_connection_dispose;
+ object_class->finalize = moko_gsmd_connection_finalize;
+
+ /* virtual methods */
+
+ /* install properties */
+}
+
+MokoGsmdConnection*
+moko_gsmd_connection_new(void)
+{
+ return g_object_new(MOKO_TYPE_GSMD_CONNECTION, NULL);
+}
+
+static void
+moko_gsmd_connection_init(MokoGsmdConnection* self)
+{
+ moko_debug( "moko_gsmd_connection_init()" );
+ MokoGsmdConnectionPrivate* priv = GSMD_CONNECTION_GET_PRIVATE(self);
+
+ priv->handle = lgsm_init( LGSMD_DEVICE_GSMD );
+ if ( !priv->handle )
+ {
+ g_warning( "libgsmd: can't connect to gsmd. You won't receive any
events." );
+ }
+ else
+ {
+ moko_debug( "-- connected to gsmd (socketfd = %d)", lgsm_fd(
priv->handle ) );
+ }
+}
Property changes on:
trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/moko-gsmd-connection.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/moko-gsmd-connection.h
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/moko-gsmd-connection.h
2007-04-12 21:52:30 UTC (rev 1732)
+++ trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/moko-gsmd-connection.h
2007-04-12 21:54:34 UTC (rev 1733)
@@ -0,0 +1,46 @@
+/* moko-gsmd-connection.h
+ *
+ * Authored By Michael 'Mickey' Lauer <[EMAIL PROTECTED]>
+ * Copyright (C) 2007 OpenMoko, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser Public License as published by
+ * the Free Software Foundation; version 2 of the license.
+ *
+ * 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 Public License for more details.
+ *
+ * Current Version: $Rev$ ($Date: 2006/12/21 18:03:04 $) [$Author: mickey $]
+ */
+
+#ifndef _MOKO_GSMD_CONNECTION_H_
+#define _MOKO_GSMD_CONNECTION_H_
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define MOKO_TYPE_GSMD_CONNECTION moko_gsmd_connection_get_type()
+#define MOKO_GSMD_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
MOKO_TYPE_GSMD_CONNECTION, MokoGsmdConnection))
+#define MOKO_GSMD_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
MOKO_TYPE_GSMD_CONNECTION, MokoGsmdConnectionClass))
+#define MOKO_IS_GSMD_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
MOKO_TYPE_GSMD_CONNECTION))
+#define MOKO_IS_GSMD_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE
((klass), MOKO_TYPE_GSMD_CONNECTION))
+#define MOKO_GSMD_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
MOKO_TYPE_GSMD_CONNECTION, MokoGsmdConnectionClass))
+
+typedef struct {
+ GObject parent;
+} MokoGsmdConnection;
+
+typedef struct {
+ GObjectClass parent_class;
+} MokoGsmdConnectionClass;
+
+GType moko_gsmd_connection_get_type();
+MokoGsmdConnection* moko_gsmd_connection_new();
+
+G_END_DECLS
+
+#endif // _MOKO_GSMD_CONNECTION_H_
+
Property changes on:
trunk/src/target/OM-2007/openmoko-libs/libmokogsmd/moko-gsmd-connection.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/src/target/OM-2007/openmoko-libs/openmoko-libs.pro
===================================================================
--- trunk/src/target/OM-2007/openmoko-libs/openmoko-libs.pro 2007-04-12
21:52:30 UTC (rev 1732)
+++ trunk/src/target/OM-2007/openmoko-libs/openmoko-libs.pro 2007-04-12
21:54:34 UTC (rev 1733)
@@ -1,2 +1,2 @@
TEMPLATE = subdirs
-SUBDIRS = libmokocore libmokonet libmokoui libmokojournal
+SUBDIRS = libmokocore libmokogsmd libmokonet libmokoui libmokojournal
--- End Message ---
_______________________________________________
commitlog mailing list
[EMAIL PROTECTED]
http://lists.openmoko.org/mailman/listinfo/commitlog