Add a dummy backend for systems without IrDA support.

This commit is contained in:
Jef Driesen 2010-02-18 09:26:32 +00:00
parent 1983e2c008
commit b295f71536
5 changed files with 124 additions and 22 deletions

View File

@ -35,8 +35,6 @@ AC_CHECK_HEADERS([sys/socket.h linux/types.h linux/irda.h], [irda_linux=yes], [i
])
AM_CONDITIONAL([IRDA], [test "$irda_win32" = "yes" || test "$irda_linux" = "yes"])
AM_CONDITIONAL([IRDA_WIN32], [test "$irda_win32" = "yes"])
AM_CONDITIONAL([IRDA_LINUX], [test "$irda_linux" = "yes"])
# Checks for library functions.
AC_CHECK_FUNCS([localtime_r gmtime_r])

View File

@ -540,7 +540,7 @@
>
<Tool
Name="VCCustomBuildTool"
CommandLine="echo EXPORTS &gt; &quot;$(OutDir)/libdivecomputer.def&quot; &amp;&amp; cl /nologo /EP -DSERIAL -DIRDA &quot;$(InputPath)&quot; &gt;&gt; &quot;$(OutDir)/libdivecomputer.def&quot;"
CommandLine="echo EXPORTS &gt; &quot;$(OutDir)/libdivecomputer.def&quot; &amp;&amp; type &quot;$(InputPath)&quot; &gt;&gt; &quot;$(OutDir)/libdivecomputer.def&quot;"
Outputs="$(OutDir)/libdivecomputer.def"
/>
</FileConfiguration>
@ -549,7 +549,7 @@
>
<Tool
Name="VCCustomBuildTool"
CommandLine="echo EXPORTS &gt; &quot;$(OutDir)/libdivecomputer.def&quot; &amp;&amp; cl /nologo /EP -DSERIAL -DIRDA &quot;$(InputPath)&quot; &gt;&gt; &quot;$(OutDir)/libdivecomputer.def&quot;"
CommandLine="echo EXPORTS &gt; &quot;$(OutDir)/libdivecomputer.def&quot; &amp;&amp; type &quot;$(InputPath)&quot; &gt;&gt; &quot;$(OutDir)/libdivecomputer.def&quot;"
Outputs="$(OutDir)/libdivecomputer.def"
/>
</FileConfiguration>

View File

@ -65,6 +65,7 @@ libdivecomputer_la_SOURCES = \
uwatec.h \
uwatec_aladin.h uwatec_aladin.c \
uwatec_memomouse.h uwatec_memomouse.c uwatec_memomouse_parser.c \
uwatec_smart.h uwatec_smart.c uwatec_smart_parser.c \
oceanic.h \
oceanic_common.h oceanic_common.c \
oceanic_atom2.h oceanic_atom2.c oceanic_atom2_parser.c \
@ -91,22 +92,18 @@ libdivecomputer_la_SOURCES += serial.h serial_posix.c
endif
if IRDA
if IRDA_WIN32
if OS_WIN32
libdivecomputer_la_LIBADD = -lws2_32
endif
libdivecomputer_la_SOURCES += \
irda.h irda.c \
uwatec_smart.h uwatec_smart.c uwatec_smart_parser.c
libdivecomputer_la_SOURCES += irda.h irda.c
else
libdivecomputer_la_SOURCES += irda.h irda_dummy.c
endif
libdivecomputer_la_DEPENDENCIES = libdivecomputer.exp
libdivecomputer.exp: libdivecomputer.symbols
if IRDA
$(AM_V_GEN) $(CPP) -P -DSERIAL -DIRDA - < $< | sed -e '/^$$/d' > $@
else
$(AM_V_GEN) $(CPP) -P -DSERIAL - < $< | sed -e '/^$$/d' > $@
endif
$(AM_V_GEN) sed -e '/^$$/d' $< > $@
CLEANFILES = libdivecomputer.exp
EXTRA_DIST = libdivecomputer.symbols

114
src/irda_dummy.c Normal file
View File

@ -0,0 +1,114 @@
/*
* libdivecomputer
*
* Copyright (C) 2010 Jef Driesen
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
#include <stddef.h>
#include "irda.h"
int
irda_errcode (void)
{
return 0;
}
const char *
irda_errmsg (void)
{
return NULL;
}
int
irda_init (void)
{
return -1;
}
int
irda_cleanup (void)
{
return -1;
}
int
irda_socket_open (irda **out)
{
return -1;
}
int
irda_socket_close (irda *device)
{
return -1;
}
int
irda_socket_set_timeout (irda *device, long timeout)
{
return -1;
}
int
irda_socket_discover (irda *device, irda_callback_t callback, void *userdata)
{
return -1;
}
int
irda_socket_connect_name (irda *device, unsigned int address, const char *name)
{
return -1;
}
int
irda_socket_connect_lsap (irda *device, unsigned int address, unsigned int lsap)
{
return -1;
}
int
irda_socket_available (irda* device)
{
return -1;
}
int
irda_socket_read (irda* device, void* data, unsigned int size)
{
return -1;
}
int
irda_socket_write (irda* device, const void *data, unsigned int size)
{
return -1;
}

View File

@ -17,7 +17,7 @@ parser_get_type
parser_set_data
parser_get_datetime
parser_samples_foreach
parser_destroy
parser_destroy
reefnet_sensus_parser_create
reefnet_sensus_parser_set_calibration
@ -26,9 +26,7 @@ reefnet_sensuspro_parser_set_calibration
reefnet_sensusultra_parser_create
reefnet_sensusultra_parser_set_calibration
uwatec_memomouse_parser_create
#ifdef IRDA
uwatec_smart_parser_create
#endif
suunto_vyper_parser_create
suunto_solution_parser_create
suunto_eon_parser_create
@ -52,7 +50,6 @@ device_write
message
message_set_logfile
#ifdef SERIAL
cressi_edy_device_open
mares_nemo_device_open
mares_nemo_extract_dives
@ -102,11 +99,7 @@ uwatec_aladin_extract_dives
uwatec_memomouse_device_open
uwatec_memomouse_device_set_timestamp
uwatec_memomouse_extract_dives
hw_ostc_device_open
#endif
#ifdef IRDA
uwatec_smart_device_open
uwatec_smart_device_set_timestamp
uwatec_smart_extract_dives
#endif
hw_ostc_device_open