android: Add initial code for socket service

Only handle register/unregister for now.
This commit is contained in:
Szymon Janc 2013-10-23 13:04:40 +02:00 committed by Johan Hedberg
parent 97732368fb
commit 9f696ad971
5 changed files with 79 additions and 1 deletions

View File

@ -10,7 +10,8 @@ android_bluetoothd_SOURCES = android/main.c \
src/shared/mgmt.h src/shared/mgmt.c \
android/adapter.h android/adapter.c \
android/hid.h android/hid.c \
android/ipc.h android/ipc.c
android/ipc.h android/ipc.c \
android/socket.h android/socket.c
android_bluetoothd_LDADD = lib/libbluetooth-internal.la @GLIB_LIBS@

View File

@ -17,6 +17,7 @@ LOCAL_SRC_FILES := \
log.c \
adapter.c \
hid.c \
socket.c \
ipc.c ipc.h \
../src/shared/mgmt.c \
../src/shared/util.c \

View File

@ -49,6 +49,7 @@
#include "src/shared/mgmt.h"
#include "adapter.h"
#include "socket.h"
#include "hid.h"
#include "hal-msg.h"
#include "ipc.h"
@ -80,6 +81,12 @@ static void service_register(void *buf, uint16_t len)
if (!bt_adapter_register(hal_notif_io))
goto error;
break;
case HAL_SERVICE_ID_SOCK:
if (!bt_socket_register(hal_notif_io,
bt_adapter_get_address()))
goto error;
break;
default:
DBG("service %u not supported", m->service_id);
@ -108,6 +115,9 @@ static void service_unregister(void *buf, uint16_t len)
case HAL_SERVICE_ID_BLUETOOTH:
bt_adapter_unregister();
break;
case HAL_SERVICE_ID_SOCK:
bt_socket_unregister();
break;
default:
/* This would indicate bug in HAL, as unregister should not be
* called in init failed */

41
android/socket.c Normal file
View File

@ -0,0 +1,41 @@
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2013 Intel Corporation. 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 St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <glib.h>
#include <stdbool.h>
#include "lib/bluetooth.h"
#include "log.h"
#include "socket.h"
bool bt_socket_register(GIOChannel *io, const bdaddr_t *addr)
{
DBG("");
return true;
}
void bt_socket_unregister(void)
{
DBG("");
}

25
android/socket.h Normal file
View File

@ -0,0 +1,25 @@
/*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2013 Intel Corporation. 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 St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
bool bt_socket_register(GIOChannel *io, const bdaddr_t *addr);
void bt_socket_unregister(void);