Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ARDrone-SDK
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
just-drone
ARDrone-SDK
Commits
17d90c75
Commit
17d90c75
authored
Jun 16, 2019
by
15김건우
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add bt test
parent
87bbd642
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
176 additions
and
2 deletions
+176
-2
Makefile
Examples/Linux/Makefile
+4
-2
Makefile
Examples/Linux/bt_test/Build/Makefile
+80
-0
main.c
Examples/Linux/bt_test/Sources/main.c
+92
-0
No files found.
Examples/Linux/Makefile
View file @
17d90c75
...
...
@@ -5,17 +5,19 @@ all:
@
$(MAKE)
-C
../../ARDroneLib/Soft/Build
USE_LINUX
=
yes
@
$(MAKE)
-C
Navigation/Build
USE_LINUX
=
yes
@
$(MAKE)
-C
custom_test/Build
USE_LINUX
=
yes
@
$(MAKE)
-C
bt_test/Build
USE_LINUX
=
yes
@
$(MAKE)
-C
sdk_demo/Build
USE_LINUX
=
yes
@
$(MAKE)
-C
video_demo/Build
USE_LINUX
=
yes
# @$(MAKE) -C Testbenches/multiconfiguration/Build USE_LINUX=yes
@$(MAKE)
-C
Testbenches/ftp_test/Build
USE_LINUX
=
yes
#
@$(MAKE) -C Testbenches/ftp_test/Build USE_LINUX=yes
$(MAKECMDGOALS)
:
@
$(MAKE)
-C
../../ARDroneLib/Soft/Build
USE_LINUX
=
yes
$(MAKECMDGOALS)
@
$(MAKE)
-C
Navigation/Build
USE_LINUX
=
yes
$(MAKECMDGOALS)
@
$(MAKE)
-C
custom_test/Build
USE_LINUX
=
yes
$(MAKECMDGOALS)
@
$(MAKE)
-C
bt_test/Build
USE_LINUX
=
yes
$(MAKECMDGOALS)
@
$(MAKE)
-C
sdk_demo/Build
USE_LINUX
=
yes
$(MAKECMDGOALS)
@
$(MAKE)
-C
video_demo/Build
USE_LINUX
=
yes
$(MAKECMDGOALS)
# @$(MAKE) -C Testbenches/multiconfiguration/Build USE_LINUX=yes $(MAKECMDGOALS)
@$(MAKE)
-C
Testbenches/ftp_test/Build
USE_LINUX
=
yes
$(MAKECMDGOALS)
#
@$(MAKE) -C Testbenches/ftp_test/Build USE_LINUX=yes $(MAKECMDGOALS)
Examples/Linux/bt_test/Build/Makefile
0 → 100644
View file @
17d90c75
SDK_PATH
:=
$(
shell
pwd
)
/../../../../ARDroneLib
PC_TARGET
=
yes
USE_LINUX
=
yes
ifdef
MYKONOS
include
$(ARDRONE_CUSTOM_CONFIG)
include
$(ARDRONE_BUILD_CONFIG)
else
include
$(SDK_PATH)/Soft/Build/custom.makefile
include
$(SDK_PATH)/Soft/Build/config.makefile
endif
ifeq
"$(RELEASE_BUILD)"
"yes"
ARDRONE_TARGET_DIR
=
$(
shell
pwd
)
/../../Build/Release
else
ARDRONE_TARGET_DIR
=
$(
shell
pwd
)
/../../Build/Debug
endif
TARGET
=
bt_test
SRC_DIR
:=
$(
shell
pwd
)
/../Sources
# Define application source files
GENERIC_BINARIES_SOURCE_DIR
:=
$(SRC_DIR)
#GENERIC_BINARIES_COMMON_SOURCE_FILES+= \
Navdata/navdata.c
\
Video/video_stage.c
\
Control/control.c
GENERIC_INCLUDES
+=
\
$(SRC_DIR)
\
$(LIB_DIR)
\
$(SDK_PATH)
/Soft/Common
\
$(SDK_PATH)
/Soft/Lib
GENERIC_TARGET_BINARIES_PREFIX
=
GENERIC_TARGET_BINARIES_DIR
=
$(ARDRONE_TARGET_DIR)
GENERIC_BINARIES_SOURCE_ENTRYPOINTS
+=
\
main.c
GENERIC_INCLUDES
:=
$
(
addprefix
-I
,
$(GENERIC_INCLUDES)
)
GENERIC_LIB_PATHS
=
-L
$(GENERIC_TARGET_BINARIES_DIR)
GENERIC_LIBS
=
-lpc_ardrone
-lgtk-x11-2
.0
-lrt
-lbluetooth
SDK_FLAGS
+=
"USE_APP=yes"
SDK_FLAGS
+=
"APP_ID=bt_test"
export
GENERIC_CFLAGS
export
GENERIC_LIBS
export
GENERIC_LIB_PATHS
export
GENERIC_INCLUDES
export
GENERIC_BINARIES_SOURCE_DIR
export
GENERIC_BINARIES_COMMON_SOURCE_FILES
export
GENERIC_TARGET_BINARIES_PREFIX
export
GENERIC_TARGET_BINARIES_DIR
export
GENERIC_BINARIES_SOURCE_ENTRYPOINTS
# Bug fix ...
export
GENERIC_LIBRARY_SOURCE_DIR
=
$(GENERIC_BINARIES_SOURCE_DIR)
.PHONY
:
$(TARGET) build_libs
all
:
build_libs $(TARGET)
$(TARGET)
:
@
$(MAKE)
-C
$(SDK_PATH)
/VP_SDK/Build
$(TMP_SDK_FLAGS)
$(SDK_FLAGS)
$(MAKECMDGOALS)
USE_LINUX
=
yes
mv
$(ARDRONE_TARGET_DIR)
/main
$(TARGET)
mv
$(TARGET)
$(ARDRONE_TARGET_DIR)
/
$(MAKECMDGOALS)
:
build_libs
@
$(MAKE)
-C
$(SDK_PATH)
/VP_SDK/Build
$(TMP_SDK_FLAGS)
$(SDK_FLAGS)
$(MAKECMDGOALS)
USE_LINUX
=
yes
build_libs
:
@
$(MAKE)
-C
$(SDK_PATH)
/Soft/Build
$(TMP_SDK_FLAGS)
$(SDK_FLAGS)
$(MAKECMDGOALS)
USE_LINUX
=
yes
Examples/Linux/bt_test/Sources/main.c
0 → 100644
View file @
17d90c75
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
#include <bluetooth/rfcomm.h>
bdaddr_t
find_client
(
char
*
target
)
{
inquiry_info
*
ii
=
NULL
;
int
max_rsp
,
num_rsp
;
int
dev_id
,
sock
,
len
,
flags
;
int
i
;
char
addr
[
19
]
=
{
0
};
char
name
[
248
]
=
{
0
};
bdaddr_t
target_channel
=
{
0
};
dev_id
=
hci_get_route
(
NULL
);
sock
=
hci_open_dev
(
dev_id
);
if
(
dev_id
<
0
||
sock
<
0
)
{
perror
(
"opening socket"
);
exit
(
1
);
}
len
=
8
;
max_rsp
=
255
;
flags
=
IREQ_CACHE_FLUSH
;
ii
=
(
inquiry_info
*
)
malloc
(
max_rsp
*
sizeof
(
inquiry_info
));
num_rsp
=
hci_inquiry
(
dev_id
,
len
,
max_rsp
,
NULL
,
&
ii
,
flags
);
if
(
num_rsp
<
0
)
perror
(
"hci_inquiry"
);
for
(
i
=
0
;
i
<
num_rsp
;
i
++
)
{
target_channel
=
(
ii
+
i
)
->
bdaddr
;
ba2str
(
&
target_channel
,
addr
);
memset
(
name
,
0
,
sizeof
(
name
));
if
(
hci_read_remote_name
(
sock
,
&
(
ii
+
i
)
->
bdaddr
,
sizeof
(
name
),
name
,
0
)
<
0
)
strcpy
(
name
,
"[unknown]"
);
int
j
=
strlen
(
name
);
while
(
name
[
j
-
1
]
==
' '
||
name
[
j
-
1
]
==
'\n'
||
name
[
j
-
1
]
==
'\r'
)
name
[
--
j
]
=
'\0'
;
if
(
strcmp
(
name
,
target
))
printf
(
"skipped: %s %s
\n
"
,
addr
,
name
);
else
{
printf
(
"find: %s %s
\n
"
,
addr
,
name
);
break
;
}
}
free
(
ii
);
close
(
sock
);
return
target_channel
;
}
int
main
(
int
argc
,
char
**
argv
)
{
struct
sockaddr_rc
addr
=
{
AF_BLUETOOTH
,
// rc_family
find_client
(
"dronermctrl"
),
// rc_bdaddr
(
uint8_t
)
1
// rc_channel
};
int
s
,
status
,
bytes_read
,
buf_end
=
0
,
i
;
char
buf
[
2048
]
=
{
0
},
bak
[
2048
]
=
{
0
};
// allocate a socket
s
=
socket
(
AF_BLUETOOTH
,
SOCK_STREAM
,
BTPROTO_RFCOMM
);
// connect to server
status
=
connect
(
s
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
));
if
(
status
<
0
)
perror
(
"connect failed"
);
while
(
1
)
{
bytes_read
=
read
(
s
,
buf
+
buf_end
,
sizeof
(
buf
));
buf_end
+=
bytes_read
;
for
(
i
=
buf_end
-
bytes_read
;
i
<
buf_end
;
++
i
)
if
(
buf
[
i
]
==
'\n'
)
{
buf
[
i
-
1
]
=
'\0'
;
printf
(
"received: [[%s]]
\n
"
,
buf
);
memcpy
(
bak
,
buf
,
sizeof
(
buf
));
memset
(
buf
,
0
,
sizeof
(
buf
));
memcpy
(
buf
,
bak
+
i
+
1
,
sizeof
(
buf
)
-
i
-
1
);
buf_end
-=
i
+
1
;
}
}
close
(
s
);
return
0
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment