Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
/src/samples/bluetooth/connect-paired.c
/*
* This file is part of the Soletta (TM) Project
*
* Copyright (C) 2016 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "soletta.h"
#include "sol-log.h"
#include "sol-mainloop.h"
#include "sol-bluetooth.h"
static struct sol_bt_scan_pending *scan;
static struct sol_bt_session *session;
static void
on_error(void *user_data, int error)
{
}
static bool
on_connect(void *user_data, struct sol_bt_conn *conn)
{
SOL_INF("Connected to device %.*s", (int)str.used, (char *)str.data);
return true;
}
static void
on_disconnect(void *user_data, struct sol_bt_conn *conn)
{
SOL_INF("Disconnected from device %.*s, trying again", (int)str.used, (char *)str.data);
}
static void
found_device(void *user_data, const struct sol_bt_device_info *device)
{
return;
if (!device->paired || !device->in_range)
return;
memcpy(&paired_device_addr, &device->addr, sizeof(paired_device_addr));
on_error, NULL);
scan = NULL;
}
static void
enabled(void *data, bool powered)
{
if (!powered)
return;
SOL_INF("Bluetooth Adapter enabled");
}
static void
shutdown(void)
{
if (scan)
if (session)
}
static void
startup(void)
{
if (!session) {
SOL_WRN("Couldn't create a Bluetooth session");
}
}