MCPcopy Create free account
hub / github.com/OpenEarable/open-earable / begin

Method begin

src/audio_play/Play_Service.cpp:7–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5//BLECharacteristic * Play_Service::_wavPlayC_static;
6
7void Play_Service::begin() {
8 _wavPlayService = new BLEService(wavPlayServiceUuid);
9 _wavPlayC = new BLECharacteristic(wavPlayUuid, BLEWrite|BLERead|BLENotify, sizeof(WAVConfigurationPacket));
10 _playerStateC = new BLECharacteristic(playerStateUuid, BLEWrite|BLERead|BLENotify, 1);
11
12 BLE.setAdvertisedService(*_wavPlayService);
13 _wavPlayService->addCharacteristic(*_wavPlayC);
14 _wavPlayService->addCharacteristic(*_playerStateC);
15 BLE.addService(*_wavPlayService);
16 _wavPlayC->setEventHandler(BLEWritten, receiveWavConfig);
17 _playerStateC->setEventHandler(BLEWritten, receivePlayerState);
18
19 _current = audio_player.get_config();
20 _wavPlayC->writeValue(&_current, sizeof(WAVConfigurationPacket));
21
22 _available = true;
23}
24
25void Play_Service::receiveWavConfig(BLEDevice central, BLECharacteristic characteristic) {
26 characteristic.readValue(&_current, sizeof(_current));

Callers

nothing calls this directly

Calls 1

get_configMethod · 0.45

Tested by

no test coverage detected