| 5 | //BLECharacteristic * Play_Service::_wavPlayC_static; |
| 6 | |
| 7 | void 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 | |
| 25 | void Play_Service::receiveWavConfig(BLEDevice central, BLECharacteristic characteristic) { |
| 26 | characteristic.readValue(&_current, sizeof(_current)); |
nothing calls this directly
no test coverage detected