diff --git a/Makefile b/Makefile index b2b9c05..351bedd 100644 --- a/Makefile +++ b/Makefile @@ -106,6 +106,7 @@ dist: $(PACKAGE)-$(VERSION)/src/modems/hayes.c \ $(PACKAGE)-$(VERSION)/src/modems/purple.c \ $(PACKAGE)-$(VERSION)/src/modems/sofia.c \ + $(PACKAGE)-$(VERSION)/src/modems/template.c \ $(PACKAGE)-$(VERSION)/src/modems/hayes.h \ $(PACKAGE)-$(VERSION)/src/modems/Makefile \ $(PACKAGE)-$(VERSION)/src/modems/osmocom.c \ diff --git a/src/modems/Makefile b/src/modems/Makefile index d50ad3a..6de220b 100644 --- a/src/modems/Makefile +++ b/src/modems/Makefile @@ -1,4 +1,4 @@ -TARGETS = debug.so hayes.so purple.so sofia.so +TARGETS = debug.so hayes.so purple.so sofia.so template.so PREFIX = /usr/local DESTDIR = LIBDIR = $(PREFIX)/lib @@ -48,6 +48,13 @@ sofia_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) `pkg-config --libs libSystem sofia-sip-ua sofia.so: $(sofia_OBJS) $(CCSHARED) -o sofia.so $(sofia_OBJS) $(sofia_LDFLAGS) +template_OBJS = template.o +template_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) `pkg-config --cflags libSystem` +template_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) `pkg-config --libs libSystem` + +template.so: $(template_OBJS) + $(CCSHARED) -o template.so $(template_OBJS) $(template_LDFLAGS) + debug.o: debug.c $(CC) $(debug_CFLAGS) -c debug.c @@ -60,8 +67,11 @@ purple.o: purple.c ../../config.h sofia.o: sofia.c $(CC) $(sofia_CFLAGS) -c sofia.c +template.o: template.c + $(CC) $(template_CFLAGS) -c template.c + clean: - $(RM) -- $(debug_OBJS) $(hayes_OBJS) $(purple_OBJS) $(sofia_OBJS) + $(RM) -- $(debug_OBJS) $(hayes_OBJS) $(purple_OBJS) $(sofia_OBJS) $(template_OBJS) distclean: clean $(RM) -- $(TARGETS) diff --git a/src/modems/project.conf b/src/modems/project.conf index 545350f..7b59ad8 100644 --- a/src/modems/project.conf +++ b/src/modems/project.conf @@ -1,4 +1,4 @@ -targets=debug,hayes,purple,sofia +targets=debug,hayes,purple,sofia,template cppflags_force=-I ../../include cppflags= cflags_force=-W `pkg-config --cflags glib-2.0` @@ -49,3 +49,9 @@ sources=sofia.c cflags=`pkg-config --cflags libSystem sofia-sip-ua-glib` ldflags=`pkg-config --libs libSystem sofia-sip-ua-glib` install=$(LIBDIR)/Phone/modem + +[template] +type=plugin +sources=template.c +cflags=`pkg-config --cflags libSystem` +ldflags=`pkg-config --libs libSystem` diff --git a/src/modems/template.c b/src/modems/template.c new file mode 100644 index 0000000..44ed7d8 --- /dev/null +++ b/src/modems/template.c @@ -0,0 +1,132 @@ +/* $Id$ */ +/* Copyright (c) 2013 Pierre Pronchery */ +/* This file is part of DeforaOS Desktop Phone */ +/* 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, version 3 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ + + + +#include +#ifdef DEBUG +# include +#endif +#include +#include + + +/* Template */ +/* private */ +/* types */ +typedef struct _ModemPlugin +{ + ModemPluginHelper * helper; +} Template; + + +/* variables */ +static ModemConfig _template_config[] = +{ + { NULL, NULL, MCT_NONE }, +}; + + +/* prototypes */ +/* plug-in */ +static ModemPlugin * _template_init(ModemPluginHelper * helper); +static void _template_destroy(ModemPlugin * modem); +static int _template_start(ModemPlugin * modem, unsigned int retry); +static int _template_stop(ModemPlugin * modem); +static int _template_request(ModemPlugin * modem, ModemRequest * request); + + +/* public */ +/* variables */ +ModemPluginDefinition plugin = +{ + "Template", + NULL, + _template_config, + _template_init, + _template_destroy, + _template_start, + _template_stop, + _template_request, + NULL +}; + + +/* private */ +/* functions */ +/* template_init */ +static ModemPlugin * _template_init(ModemPluginHelper * helper) +{ + Template * template; + + if((template = object_new(sizeof(*template))) == NULL) + return NULL; + memset(template, 0, sizeof(*template)); + template->helper = helper; + /* FIXME implement */ + return template; +} + + +/* template_destroy */ +static void _template_destroy(ModemPlugin * modem) +{ + Template * template = modem; + + _template_stop(modem); + /* FIXME implement */ + object_delete(template); +} + + +/* template_start */ +static int _template_start(ModemPlugin * modem, unsigned int retry) +{ + Template * template = modem; + +#ifdef DEBUG + fprintf(stderr, "DEBUG: %s()\n", __func__); +#endif + /* FIXME implement */ + return 0; +} + + +/* template_stop */ +static int _template_stop(ModemPlugin * modem) +{ + Template * template = modem; + +#ifdef DEBUG + fprintf(stderr, "DEBUG: %s()\n", __func__); +#endif + /* FIXME implement */ + return 0; +} + + +/* template_request */ +static int _template_request(ModemPlugin * modem, ModemRequest * request) +{ + switch(request->type) + { + /* FIXME implement */ +#ifndef DEBUG + default: + break; +#endif + } + return 0; +}