79 lines
2.0 KiB
C++
Executable File
79 lines
2.0 KiB
C++
Executable File
/*
|
|
* Copyright 2019 HIMSA II K/S - www.himsa.dk.
|
|
* Represented by EHIMA - www.ehima.com
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <hardware/bluetooth.h>
|
|
#include "hardware/bt_le_audio.h"
|
|
|
|
#include "raw_address.h"
|
|
|
|
namespace bluetooth {
|
|
namespace tbs {
|
|
|
|
enum class AudioState {
|
|
DISCONNECTED = 10,
|
|
CONNECTING,
|
|
CONNECTED
|
|
};
|
|
|
|
class TbsCallbacks {
|
|
public:
|
|
virtual ~TbsCallbacks() = default;
|
|
|
|
/** Callback for profile audio state change */
|
|
virtual void OnAudioState(bluetooth::tbs::AudioState fromState,
|
|
bluetooth::tbs::AudioState toState,
|
|
const RawAddress& address) = 0;
|
|
|
|
/** Callback for profile connection state change */
|
|
virtual void OnConnectionState(bluetooth::le_audio::ConnectionState state,
|
|
const RawAddress& address) = 0;
|
|
};
|
|
|
|
class TbsInterface {
|
|
public:
|
|
virtual ~TbsInterface() = default;
|
|
|
|
/* Register the Tbs callbacks */
|
|
virtual void Initialize(TbsCallbacks* callbacks) = 0;
|
|
|
|
/* Cleanup the Tbs */
|
|
virtual void Cleanup(void) = 0;
|
|
|
|
/** Call Start */
|
|
virtual void CallStart(int) = 0;
|
|
|
|
/** Call Stop */
|
|
virtual void CallStop(int) = 0;
|
|
};
|
|
|
|
} /* namespace tbs */
|
|
} /* namespace bluetooth */
|
|
|
|
typedef struct {
|
|
size_t size;
|
|
|
|
bt_status_t (*init)(bluetooth::tbs::TbsCallbacks* callbacks);
|
|
|
|
void (*cleanup)(void);
|
|
|
|
void (*call_start)(int);
|
|
|
|
void (*call_stop)(int);
|
|
} blecg_interface_t;
|