samples: net: http: client: Enable Bluetooth if configured

If Bluetooth IPSP is enabled, then set the http client to use it.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
Jukka Rissanen 2017-07-28 15:35:53 +03:00
parent 47be0f4989
commit 0134abe368
3 changed files with 30 additions and 0 deletions

View file

@ -20,6 +20,11 @@
#include <net/net_app.h>
#if defined(CONFIG_NET_L2_BLUETOOTH)
#include <bluetooth/bluetooth.h>
#include <gatt/ipss.h>
#endif
#include "config.h"
#define MAX_ITERATIONS 20
@ -330,6 +335,15 @@ void main(void)
{
int ret;
#if defined(CONFIG_NET_L2_BLUETOOTH)
if (bt_enable(NULL) == 0) {
ipss_init();
ipss_advertise();
} else {
NET_ERR("Bluetooth init failed");
}
#endif
ret = http_client_init(&http_ctx, SERVER_ADDR, SERVER_PORT);
if (ret < 0) {
NET_ERR("HTTP init failed (%d)", ret);

View file

@ -4,4 +4,6 @@
# SPDX-License-Identifier: Apache-2.0
#
include $(ZEPHYR_BASE)/samples/net/common/Makefile.common
obj-y += main.o

View file

@ -20,6 +20,11 @@
#include <net/net_app.h>
#if defined(CONFIG_NET_L2_BLUETOOTH)
#include <bluetooth/bluetooth.h>
#include <gatt/ipss.h>
#endif
#include "config.h"
#define INSTANCE_INFO "Zephyr HTTPS example client #1"
@ -393,6 +398,15 @@ void main(void)
bool failure = false;
int ret;
#if defined(CONFIG_NET_L2_BLUETOOTH)
if (bt_enable(NULL) == 0) {
ipss_init();
ipss_advertise();
} else {
NET_ERR("Bluetooth init failed");
}
#endif
ret = https_client_init(&https_ctx, SERVER_ADDR, SERVER_PORT,
(u8_t *)INSTANCE_INFO, strlen(INSTANCE_INFO),
setup_cert, HOSTNAME, NULL, &ssl_rx_pool,