summaryrefslogtreecommitdiff
path: root/emulator/main.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2013-12-28 21:49:49 -0800
committerMarcel Holtmann <marcel@holtmann.org>2013-12-28 21:49:49 -0800
commit7f92310ccc5b9bcd069e079502ecf9c130b3b269 (patch)
treeba4868362879d1acea0f8851232aa5d9d508547b /emulator/main.c
parent0007671cf8c35b159e86ea0b6fb6f16e8cc29844 (diff)
downloadbluez-7f92310ccc5b9bcd069e079502ecf9c130b3b269.tar.gz
emulator: Add simple standalone single mode LE device
Diffstat (limited to 'emulator/main.c')
-rw-r--r--emulator/main.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/emulator/main.c b/emulator/main.c
index 85b10f1f1..15f9c54aa 100644
--- a/emulator/main.c
+++ b/emulator/main.c
@@ -35,6 +35,7 @@
#include "server.h"
#include "vhci.h"
#include "amp.h"
+#include "le.h"
static void signal_callback(int signum, void *user_data)
{
@@ -66,6 +67,7 @@ static const struct option main_options[] = {
{ "le", no_argument, NULL, 'L' },
{ "bredr", no_argument, NULL, 'B' },
{ "amp", no_argument, NULL, 'A' },
+ { "letest", optional_argument, NULL, 'U' },
{ "amptest", optional_argument, NULL, 'T' },
{ "version", no_argument, NULL, 'v' },
{ "help", no_argument, NULL, 'h' },
@@ -80,6 +82,7 @@ int main(int argc, char *argv[])
struct server *server4;
struct server *server5;
bool server_enabled = false;
+ int letest_count = 0;
int amptest_count = 0;
int vhci_count = 0;
enum vhci_type vhci_type = VHCI_TYPE_BREDRLE;
@@ -91,7 +94,8 @@ int main(int argc, char *argv[])
for (;;) {
int opt;
- opt = getopt_long(argc, argv, "sl::LBATvh", main_options, NULL);
+ opt = getopt_long(argc, argv, "sl::LBAUTvh",
+ main_options, NULL);
if (opt < 0)
break;
@@ -114,6 +118,12 @@ int main(int argc, char *argv[])
case 'A':
vhci_type = VHCI_TYPE_AMP;
break;
+ case 'U':
+ if (optarg)
+ letest_count = atoi(optarg);
+ else
+ letest_count = 1;
+ break;
case 'T':
if (optarg)
amptest_count = atoi(optarg);
@@ -131,7 +141,8 @@ int main(int argc, char *argv[])
}
}
- if (amptest_count < 1 && vhci_count < 1 && !server_enabled) {
+ if (letest_count < 1 && amptest_count < 1 &&
+ vhci_count < 1 && !server_enabled) {
fprintf(stderr, "No emulator specified\n");
return EXIT_FAILURE;
}
@@ -144,6 +155,16 @@ int main(int argc, char *argv[])
printf("Bluetooth emulator ver %s\n", VERSION);
+ for (i = 0; i < letest_count; i++) {
+ struct bt_le *le;
+
+ le = bt_le_new();
+ if (!le) {
+ fprintf(stderr, "Failed to create LE controller\n");
+ return EXIT_FAILURE;
+ }
+ }
+
for (i = 0; i < amptest_count; i++) {
struct bt_amp *amp;