Lines Matching refs:device

82     auto device = volume_control_devices_.FindByAddress(address);  in Connect()  local
83 if (!device) { in Connect()
86 device->connecting_actively = true; in Connect()
110 VolumeControlDevice* device = in OnGattConnected() local
112 if (!device) { in OnGattConnected()
119 device_cleanup_helper(device, device->connecting_actively); in OnGattConnected()
123 device->connection_id = connection_id; in OnGattConnected()
125 if (device->IsEncryptionEnabled()) { in OnGattConnected()
130 if (!device->EnableEncryption(enc_callback_static)) { in OnGattConnected()
131 device_cleanup_helper(device, device->connecting_actively); in OnGattConnected()
136 VolumeControlDevice* device = in OnEncryptionComplete() local
138 if (!device) { in OnEncryptionComplete()
149 device->Disconnect(gatt_if_); in OnEncryptionComplete()
150 if (device->connecting_actively) in OnEncryptionComplete()
152 device->address); in OnEncryptionComplete()
158 if (device->HasHandles()) { in OnEncryptionComplete()
159 device->EnqueueInitialRequests(gatt_if_, chrc_read_callback_static, in OnEncryptionComplete()
163 device->first_connection = true; in OnEncryptionComplete()
164 BTA_GATTC_ServiceSearchRequest(device->connection_id, in OnEncryptionComplete()
170 VolumeControlDevice* device = in OnServiceChangeEvent() local
172 if (!device) { in OnServiceChangeEvent()
177 device->first_connection = true; in OnServiceChangeEvent()
178 device->service_changed_rcvd = true; in OnServiceChangeEvent()
179 BtaGattQueue::Clean(device->connection_id); in OnServiceChangeEvent()
183 VolumeControlDevice* device = in OnServiceDiscDoneEvent() local
185 if (!device) { in OnServiceDiscDoneEvent()
190 if (device->service_changed_rcvd) in OnServiceDiscDoneEvent()
191 BTA_GATTC_ServiceSearchRequest(device->connection_id, in OnServiceDiscDoneEvent()
196 VolumeControlDevice* device = in OnServiceSearchComplete() local
198 if (!device) { in OnServiceSearchComplete()
205 if (!device->first_connection) return; in OnServiceSearchComplete()
210 device_cleanup_helper(device, device->first_connection); in OnServiceSearchComplete()
214 bool success = device->UpdateHandles(); in OnServiceSearchComplete()
217 device_cleanup_helper(device, true); in OnServiceSearchComplete()
221 device->EnqueueInitialRequests(gatt_if_, chrc_read_callback_static, in OnServiceSearchComplete()
228 VolumeControlDevice* device = volume_control_devices_.FindByConnId(conn_id); in OnCharacteristicValueChanged() local
229 if (!device) { in OnCharacteristicValueChanged()
239 if (handle == device->volume_state_handle) { in OnCharacteristicValueChanged()
240 OnVolumeControlStateChanged(device, len, value); in OnCharacteristicValueChanged()
241 verify_device_ready(device, handle); in OnCharacteristicValueChanged()
244 if (handle == device->volume_flags_handle) { in OnCharacteristicValueChanged()
245 OnVolumeControlFlagsChanged(device, len, value); in OnCharacteristicValueChanged()
246 verify_device_ready(device, handle); in OnCharacteristicValueChanged()
265 void OnVolumeControlStateChanged(VolumeControlDevice* device, uint16_t len, in OnVolumeControlStateChanged() argument
273 STREAM_TO_UINT8(device->volume, pp); in OnVolumeControlStateChanged()
274 STREAM_TO_UINT8(device->mute, pp); in OnVolumeControlStateChanged()
275 STREAM_TO_UINT8(device->change_counter, pp); in OnVolumeControlStateChanged()
278 LOG(INFO) << __func__ << "volume " << loghex(device->volume) << "mute" in OnVolumeControlStateChanged()
279 << loghex(device->mute) << "change_counter" in OnVolumeControlStateChanged()
280 << loghex(device->change_counter); in OnVolumeControlStateChanged()
282 if (!device->device_ready) return; in OnVolumeControlStateChanged()
284 callbacks_->OnVolumeStateChanged(device->address, device->volume, in OnVolumeControlStateChanged()
285 device->mute); in OnVolumeControlStateChanged()
288 void OnVolumeControlFlagsChanged(VolumeControlDevice* device, uint16_t len, in OnVolumeControlFlagsChanged() argument
290 device->flags = *value; in OnVolumeControlFlagsChanged()
293 LOG(INFO) << __func__ << "flags " << loghex(device->flags); in OnVolumeControlFlagsChanged()
298 VolumeControlDevice* device = in OnGattWriteCcc() local
300 if (!device) { in OnGattWriteCcc()
311 device_cleanup_helper(device, true); in OnGattWriteCcc()
318 verify_device_ready(device, handle); in OnGattWriteCcc()
334 VolumeControlDevice* device = in Disconnect() local
336 if (!device) { in Disconnect()
342 LOG(INFO) << "GAP_EVT_CONN_CLOSED: " << device->address; in Disconnect()
343 device_cleanup_helper(device, true); in Disconnect()
349 VolumeControlDevice* device = in OnGattDisconnected() local
351 if (!device) { in OnGattDisconnected()
359 bool device_ready = device->device_ready; in OnGattDisconnected()
361 device_cleanup_helper(device, device->connecting_actively); in OnGattDisconnected()
373 VolumeControlDevice* device = in OnWriteControlResponse() local
375 if (!device) { in OnWriteControlResponse()
414 void verify_device_ready(VolumeControlDevice* device, uint16_t handle) { in verify_device_ready() argument
415 if (device->device_ready) return; in verify_device_ready()
419 if (device->VerifyReady(handle)) { in verify_device_ready()
423 device->address); in verify_device_ready()
425 device->connecting_actively = true; in verify_device_ready()
427 device->first_connection = false; in verify_device_ready()
430 callbacks_->OnVolumeStateChanged(device->address, device->volume, in verify_device_ready()
431 device->mute); in verify_device_ready()
433 device->EnqueueRemainingRequests(gatt_if_, chrc_read_callback_static, in verify_device_ready()
438 void device_cleanup_helper(VolumeControlDevice* device, bool notify) { in device_cleanup_helper() argument
439 device->Disconnect(gatt_if_); in device_cleanup_helper()
442 device->address); in device_cleanup_helper()
443 volume_control_devices_.Remove(device->address); in device_cleanup_helper()