Skip to content

Commit

Permalink
Implemented profile registration with bluez and connection handling
Browse files Browse the repository at this point in the history
  • Loading branch information
raviminnikanti committed Oct 8, 2018
0 parents commit 9c8656f
Show file tree
Hide file tree
Showing 15 changed files with 1,009 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

# ignore all hidden files.

.cproject
.project
.settings/*

2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

Ravi Minnikanti (ravichandraminnikanti@gmail.com)
7 changes: 7 additions & 0 deletions NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@


1. hfp_recorder doesn't start "Service Level Connection establishment (RFCOMM)" procedure.
It should be started by AG device.

2. hfp_recorder doesn't start Synchronous Connection Oriented(SCO) connection. It should
be started from AG device.
10 changes: 10 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

Currently this project is not yet complete. Current version is 0.1.


1. hfp_recorder implements Bluetooth HFP profile.
2. It is a Linux based application and it acts as HF in HFP profile.


Dependencies:
Embedded Linux Library (ELL)
2 changes: 2 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

1. autotools support for the project, for automatic dependency checking and Makefile generation.
13 changes: 13 additions & 0 deletions include/at_parser.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* at_parser.h
* Copyright (C) 2015-2016 Ooma Incorporated. All rights reserved.
*/

#ifndef AT_PARSER_H_
#define AT_PARSER_H_

void handle_recv_data(char *data, int bytes_read);
bool is_valid_at_command(const char *cmd);
bool send_command(const char *cmd);

#endif /* AT_PARSER_H_ */
13 changes: 13 additions & 0 deletions include/dbus.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* dbus.h
*/

#ifndef DBUS_H_
#define DBUS_H_

#include <stdbool.h>

bool dbus_init(void);
void dbus_cleanup(void);

#endif /* DBUS_H_ */
18 changes: 18 additions & 0 deletions include/main.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* main.h
*/


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <errno.h>
#include <unistd.h>

#include <ell/ell.h>

#include "socket.h"
#include "dbus.h"

#define VERSION "0.1"
7 changes: 7 additions & 0 deletions include/socket.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

#ifndef SOCKET_H_
#define SOCKET_H_

void new_rfcomm_connection(int sock);

#endif
206 changes: 206 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
#############################################################################
#
# Generic Makefile for C/C++ Program
#
# License: GPL (General Public License)
# Author: whyglinux <whyglinux AT gmail DOT com>
# Date: 2006/03/04 (version 0.1)
# 2007/03/24 (version 0.2)
# 2007/04/09 (version 0.3)
# 2007/06/26 (version 0.4)
# 2008/04/05 (version 0.5)

# The pre-processor and compiler options.
MY_CFLAGS = -std=gnu99 -I. -I../include
MY_CFLAGS += $(shell pkg-config --cflags ell)
# The pre-processor options used by the cpp (man cpp for more).
CPPFLAGS = -Wall

# The options used in linking as well as in any direct use of ld.

LDFLAGS += -ldl $(shell pkg-config --libs ell)

# The directories in which source files reside.
# If not specified, only the current directory will be serached.
SRCDIRS = .

# The executable file name.
# If not specified, current directory name or `a.out' will be used.
PROGRAM = hfp_recorder

CC = $(CROSS_COMPILE)gcc

## Implicit Section: change the following only when necessary.
##==========================================================================

# The source file types (headers excluded).
# .c indicates C source files, and others C++ ones.
SRCEXTS = .c .C .cc .cpp .CPP .c++ .cxx .cp

# The header file types.
HDREXTS = .h .H .hh .hpp .HPP .h++ .hxx .hp

# The pre-processor and compiler options.
# Users can override those variables from the command line.
CFLAGS = -g -O0
CXXFLAGS= -g -O0

# The C program compiler.
#CC = gcc

# The C++ program compiler.
#CXX = g++

# Un-comment the following line to compile C programs as C++ ones.
#CC = $(CXX)

# The command used to delete file.
#RM = rm -f

ETAGS = etags
ETAGSFLAGS =

CTAGS = ctags
CTAGSFLAGS =

## Stable Section: usually no need to be changed. But you can add more.
##==========================================================================
SHELL = /bin/sh
EMPTY =
SPACE = $(EMPTY) $(EMPTY)
ifeq ($(PROGRAM),)
CUR_PATH_NAMES = $(subst /,$(SPACE),$(subst $(SPACE),_,$(CURDIR)))
PROGRAM = $(word $(words $(CUR_PATH_NAMES)),$(CUR_PATH_NAMES))
ifeq ($(PROGRAM),)
PROGRAM = a.out
endif
endif
ifeq ($(SRCDIRS),)
SRCDIRS = .
endif
SOURCES = $(foreach d,$(SRCDIRS),$(wildcard $(addprefix $(d)/*,$(SRCEXTS))))
HEADERS = $(foreach d,$(SRCDIRS),$(wildcard $(addprefix $(d)/*,$(HDREXTS))))
SRC_CXX = $(filter-out %.c,$(SOURCES))
OBJS = $(addsuffix .o, $(basename $(SOURCES)))

## Define some useful variables.
COMPILE.c = $(CC) $(MY_CFLAGS) $(CFLAGS) $(CPPFLAGS) -c
COMPILE.cxx = $(CXX) $(MY_CFLAGS) $(CXXFLAGS) $(CPPFLAGS) -c
LINK.c = $(CC) $(MY_CFLAGS) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
LINK.cxx = $(CXX) $(MY_CFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)


# Delete the default suffixes
.SUFFIXES:

all: $(PROGRAM)

# Rules for generating object files (.o).
#----------------------------------------
objs:$(OBJS)

%.o:%.c
$(COMPILE.c) $< -o $@

%.o:%.C
$(COMPILE.cxx) $< -o $@

%.o:%.cc
$(COMPILE.cxx) $< -o $@

%.o:%.cpp
$(COMPILE.cxx) $< -o $@

%.o:%.CPP
$(COMPILE.cxx) $< -o $@

%.o:%.c++
$(COMPILE.cxx) $< -o $@

%.o:%.cp
$(COMPILE.cxx) $< -o $@

%.o:%.cxx
$(COMPILE.cxx) $< -o $@

# Rules for generating the tags.
#-------------------------------------
tags: $(HEADERS) $(SOURCES)
$(ETAGS) $(ETAGSFLAGS) $(HEADERS) $(SOURCES)

ctags: $(HEADERS) $(SOURCES)
$(CTAGS) $(CTAGSFLAGS) $(HEADERS) $(SOURCES)

# Rules for generating the executable.
#-------------------------------------
$(PROGRAM):$(OBJS)
ifeq ($(SRC_CXX),) # C program
$(LINK.c) $(OBJS) -o $@
@echo Type ./$@ to execute the program.
else # C++ program
$(LINK.cxx) $(OBJS) -o $@
@echo Type ./$@ to execute the program.
endif

ifndef NODEP
ifneq ($(DEPS),)
sinclude $(DEPS)
endif
endif

test: $(PROGRAM)
$(MAKE) -C ./test

.version: ../include/main.h
# drop the version file to PWD
( \
grep VERSION ../include/main.h | tr \" " " | awk '{ print $$3 }' > .version \
)

clean:
$(RM) $(OBJS) $(PROGRAM) $(PROGRAM).exe *.d *.c~ *.h~ *.o .xml .version
find . -name "*~" | xargs $(RM)

distclean: clean
$(RM) $(DEPS) TAGS
$(MAKE) -C ./test $@

# Show help.
help:
@echo 'Generic Makefile for C/C++ Programs (gcmakefile) version 0.5'
@echo 'Copyright (C) 2007, 2008 whyglinux <whyglinux@hotmail.com>'
@echo
@echo 'Usage: make [TARGET]'
@echo 'TARGETS:'
@echo ' all (=make) compile and link.'
@echo ' NODEP=yes make without generating dependencies.'
@echo ' objs compile only (no linking).'
@echo ' tags create tags for Emacs editor.'
@echo ' ctags create ctags for VI editor.'
@echo ' clean clean objects and the executable file.'
@echo ' distclean clean objects, the executable and dependencies.'
@echo ' show show variables (for debug use only).'
@echo ' help print this message.'
@echo
@echo 'Report bugs to <whyglinux AT gmail DOT com>.'

# Show variables (for debug use only.)
show:
@echo 'PROGRAM :' $(PROGRAM)
@echo 'SRCDIRS :' $(SRCDIRS)
@echo 'HEADERS :' $(HEADERS)
@echo 'SOURCES :' $(SOURCES)
@echo 'SRC_CXX :' $(SRC_CXX)
@echo 'OBJS :' $(OBJS)
@echo 'DEPS :' $(DEPS)
@echo 'DEPEND :' $(DEPEND)
@echo 'COMPILE.c :' $(COMPILE.c)
@echo 'COMPILE.cxx :' $(COMPILE.cxx)
@echo 'link.c :' $(LINK.c)
@echo 'link.cxx :' $(LINK.cxx)
@echo 'LDFLAGS :' $(LDFLAGS)

.PHONY: all objs tags ctags clean distclean help show test
## End of the Makefile ## Suggestions are welcome ## All rights reserved ##
#############################################################################

Loading

0 comments on commit 9c8656f

Please sign in to comment.