Lines Matching refs:slot
212 struct eds_slot *slot = &eds_slots[eds_active_slot]; in read_tx_power() local
214 if (slot->state == EDS_LOCKED) { in read_tx_power()
218 return bt_gatt_attr_read(conn, attr, buf, len, offset, &slot->tx_power, in read_tx_power()
219 sizeof(slot->tx_power)); in read_tx_power()
227 struct eds_slot *slot = &eds_slots[eds_active_slot]; in write_tx_power() local
229 if (slot->state == EDS_LOCKED) { in write_tx_power()
233 if (offset + len > sizeof(slot->tx_power)) { in write_tx_power()
237 memcpy(&slot->tx_power, buf, len); in write_tx_power()
246 struct eds_slot *slot = &eds_slots[eds_active_slot]; in read_adv_tx_power() local
248 if (slot->state == EDS_LOCKED) { in read_adv_tx_power()
252 return bt_gatt_attr_read(conn, attr, buf, len, offset, &slot->tx_power, in read_adv_tx_power()
253 sizeof(slot->tx_power)); in read_adv_tx_power()
262 struct eds_slot *slot = &eds_slots[eds_active_slot]; in write_adv_tx_power() local
264 if (slot->state == EDS_LOCKED) { in write_adv_tx_power()
268 if (offset + len > sizeof(slot->adv_tx_power)) { in write_adv_tx_power()
272 memcpy(&slot->adv_tx_power, buf, len); in write_adv_tx_power()
281 struct eds_slot *slot = &eds_slots[eds_active_slot]; in read_interval() local
283 if (slot->state == EDS_LOCKED) { in read_interval()
287 return bt_gatt_attr_read(conn, attr, buf, len, offset, &slot->interval, in read_interval()
288 sizeof(slot->interval)); in read_interval()
294 struct eds_slot *slot = &eds_slots[eds_active_slot]; in read_lock() local
296 return bt_gatt_attr_read(conn, attr, buf, len, offset, &slot->state, in read_lock()
297 sizeof(slot->state)); in read_lock()
304 struct eds_slot *slot = &eds_slots[eds_active_slot]; in write_lock() local
307 if (slot->state == EDS_LOCKED) { in write_lock()
330 slot->state = value; in write_lock()
339 struct eds_slot *slot = &eds_slots[eds_active_slot]; in read_unlock() local
341 if (slot->state != EDS_LOCKED) { in read_unlock()
348 if (bt_rand(slot->challenge, sizeof(slot->challenge))) { in read_unlock()
352 return bt_gatt_attr_read(conn, attr, buf, len, offset, slot->challenge, in read_unlock()
353 sizeof(slot->challenge)); in read_unlock()
360 struct eds_slot *slot = &eds_slots[eds_active_slot]; in write_unlock() local
362 if (slot->state != EDS_LOCKED) { in write_unlock()
399 struct eds_slot *slot = &eds_slots[eds_active_slot]; in read_adv_data() local
401 if (slot->state == EDS_LOCKED) { in read_adv_data()
408 if (slot->type == EDS_TYPE_NONE) { in read_adv_data()
413 slot->ad[2].data + EDS_URL_READ_OFFSET, in read_adv_data()
414 slot->ad[2].data_len - EDS_URL_READ_OFFSET); in read_adv_data()
417 static int eds_slot_restart(struct eds_slot *slot, uint8_t type) in eds_slot_restart() argument
439 err = bt_le_adv_start(BT_LE_ADV_NCONN_IDENTITY, slot->ad, in eds_slot_restart()
440 ARRAY_SIZE(slot->ad), NULL, 0); in eds_slot_restart()
451 slot->type = type; in eds_slot_restart()
461 struct eds_slot *slot = &eds_slots[eds_active_slot]; in write_adv_data() local
464 if (slot->state == EDS_LOCKED) { in write_adv_data()
474 eds_slot_restart(slot, EDS_TYPE_NONE); in write_adv_data()
494 slot->ad[2].data_len = MIN(slot->ad[2].data_len, in write_adv_data()
496 memcpy((uint8_t *) slot->ad[2].data + EDS_URL_WRITE_OFFSET, buf, in write_adv_data()
497 slot->ad[2].data_len - EDS_URL_WRITE_OFFSET); in write_adv_data()
500 if (eds_slot_restart(slot, type) < 0) { in write_adv_data()
541 struct eds_slot *slot = &eds_slots[eds_active_slot]; in write_connectable() local
543 if (slot->state == EDS_LOCKED) { in write_connectable()
551 if (len > sizeof(slot->connectable)) { in write_connectable()
558 memcpy(&slot->connectable, buf, len); in write_connectable()
673 struct eds_slot *slot = &eds_slots[eds_active_slot]; in disconnected() local
677 if (!slot->connectable) { in disconnected()