1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
/*
* Copyright 2020 HIMSA II K/S - www.himsa.com. 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 <vector>
#include "btm_iso_api.h"
#include "btm_iso_api_types.h"
#include "devices.h"
#include "hardware/bt_le_audio.h"
#include "le_audio_types.h"
namespace le_audio {
/* State machine interface */
class LeAudioGroupStateMachine {
public:
class Callbacks {
public:
virtual ~Callbacks() = default;
virtual void StatusReportCb(
int group_id, bluetooth::le_audio::GroupStreamStatus status) = 0;
virtual void OnStateTransitionTimeout(int group_id) = 0;
};
virtual ~LeAudioGroupStateMachine() = default;
static void Initialize(Callbacks* state_machine_callbacks);
static void Cleanup(void);
static LeAudioGroupStateMachine* Get(void);
virtual bool AttachToStream(LeAudioDeviceGroup* group,
LeAudioDevice* leAudioDevice) = 0;
virtual bool StartStream(LeAudioDeviceGroup* group,
types::LeAudioContextType context_type,
int ccid = -1) = 0;
virtual void SuspendStream(LeAudioDeviceGroup* group) = 0;
virtual bool ConfigureStream(LeAudioDeviceGroup* group,
le_audio::types::LeAudioContextType context_type,
int ccid = -1) = 0;
virtual void StopStream(LeAudioDeviceGroup* group) = 0;
virtual void ProcessGattNotifEvent(uint8_t* value, uint16_t len,
struct types::ase* ase,
LeAudioDevice* leAudioDevice,
LeAudioDeviceGroup* group) = 0;
virtual void ProcessHciNotifOnCigCreate(
LeAudioDeviceGroup* group, uint8_t status, uint8_t cig_id,
std::vector<uint16_t> conn_handles) = 0;
virtual void ProcessHciNotifOnCigRemove(uint8_t status,
LeAudioDeviceGroup* group) = 0;
virtual void ProcessHciNotifCisEstablished(
LeAudioDeviceGroup* group, LeAudioDevice* leAudioDevice,
const bluetooth::hci::iso_manager::cis_establish_cmpl_evt* event) = 0;
virtual void ProcessHciNotifCisDisconnected(
LeAudioDeviceGroup* group, LeAudioDevice* leAudioDevice,
const bluetooth::hci::iso_manager::cis_disconnected_evt* event) = 0;
virtual void ProcessHciNotifSetupIsoDataPath(LeAudioDeviceGroup* group,
LeAudioDevice* leAudioDevice,
uint8_t status,
uint16_t conn_hdl) = 0;
virtual void ProcessHciNotifRemoveIsoDataPath(LeAudioDeviceGroup* group,
LeAudioDevice* leAudioDevice,
uint8_t status,
uint16_t conn_hdl) = 0;
virtual void ProcessHciNotifIsoLinkQualityRead(
LeAudioDeviceGroup* group, LeAudioDevice* leAudioDevice,
uint8_t conn_handle, uint32_t txUnackedPackets, uint32_t txFlushedPackets,
uint32_t txLastSubeventPackets, uint32_t retransmittedPackets,
uint32_t crcErrorPackets, uint32_t rxUnreceivedPackets,
uint32_t duplicatePackets) = 0;
virtual void ProcessHciNotifAclDisconnected(LeAudioDeviceGroup* group,
LeAudioDevice* leAudioDevice) = 0;
};
} // namespace le_audio
|