Imported a template for modem plug-ins
This commit is contained in:
parent
5138923301
commit
472e5327b4
1
Makefile
1
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 \
|
||||
|
@ -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)
|
||||
|
@ -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`
|
||||
|
132
src/modems/template.c
Normal file
132
src/modems/template.c
Normal file
@ -0,0 +1,132 @@
|
||||
/* $Id$ */
|
||||
/* Copyright (c) 2013 Pierre Pronchery <khorben@defora.org> */
|
||||
/* 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 <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#include <string.h>
|
||||
#ifdef DEBUG
|
||||
# include <stdio.h>
|
||||
#endif
|
||||
#include <System.h>
|
||||
#include <Phone/modem.h>
|
||||
|
||||
|
||||
/* 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user