Lines Matching full:slot

121 	.slot_types = EDS_SLOT_URL, /* TODO: Add support for other slot types */
208 struct eds_slot *slot = &eds_slots[eds_active_slot]; in read_tx_power() local
210 if (slot->state == EDS_LOCKED) { in read_tx_power()
214 return bt_gatt_attr_read(conn, attr, buf, len, offset, &slot->tx_power, in read_tx_power()
215 sizeof(slot->tx_power)); in read_tx_power()
223 struct eds_slot *slot = &eds_slots[eds_active_slot]; in write_tx_power() local
225 if (slot->state == EDS_LOCKED) { in write_tx_power()
229 if (offset + len > sizeof(slot->tx_power)) { in write_tx_power()
233 memcpy(&slot->tx_power, buf, len); in write_tx_power()
242 struct eds_slot *slot = &eds_slots[eds_active_slot]; in read_adv_tx_power() local
244 if (slot->state == EDS_LOCKED) { in read_adv_tx_power()
248 return bt_gatt_attr_read(conn, attr, buf, len, offset, &slot->tx_power, in read_adv_tx_power()
249 sizeof(slot->tx_power)); in read_adv_tx_power()
258 struct eds_slot *slot = &eds_slots[eds_active_slot]; in write_adv_tx_power() local
260 if (slot->state == EDS_LOCKED) { in write_adv_tx_power()
264 if (offset + len > sizeof(slot->adv_tx_power)) { in write_adv_tx_power()
268 memcpy(&slot->adv_tx_power, buf, len); in write_adv_tx_power()
277 struct eds_slot *slot = &eds_slots[eds_active_slot]; in read_interval() local
279 if (slot->state == EDS_LOCKED) { in read_interval()
283 return bt_gatt_attr_read(conn, attr, buf, len, offset, &slot->interval, in read_interval()
284 sizeof(slot->interval)); in read_interval()
290 struct eds_slot *slot = &eds_slots[eds_active_slot]; in read_lock() local
292 return bt_gatt_attr_read(conn, attr, buf, len, offset, &slot->state, in read_lock()
293 sizeof(slot->state)); in read_lock()
300 struct eds_slot *slot = &eds_slots[eds_active_slot]; in write_lock() local
303 if (slot->state == EDS_LOCKED) { in write_lock()
326 slot->state = value; in write_lock()
335 struct eds_slot *slot = &eds_slots[eds_active_slot]; in read_unlock() local
337 if (slot->state != EDS_LOCKED) { in read_unlock()
344 if (bt_rand(slot->challenge, sizeof(slot->challenge))) { in read_unlock()
348 return bt_gatt_attr_read(conn, attr, buf, len, offset, slot->challenge, in read_unlock()
349 sizeof(slot->challenge)); in read_unlock()
356 struct eds_slot *slot = &eds_slots[eds_active_slot]; in write_unlock() local
358 if (slot->state != EDS_LOCKED) { in write_unlock()
395 struct eds_slot *slot = &eds_slots[eds_active_slot]; in read_adv_data() local
397 if (slot->state == EDS_LOCKED) { in read_adv_data()
401 /* If the slot is currently not broadcasting, reading the slot data in read_adv_data()
404 if (slot->type == EDS_TYPE_NONE) { in read_adv_data()
409 slot->ad[2].data + EDS_URL_READ_OFFSET, in read_adv_data()
410 slot->ad[2].data_len - EDS_URL_READ_OFFSET); in read_adv_data()
413 static int eds_slot_restart(struct eds_slot *slot, uint8_t type) in eds_slot_restart() argument
425 /* Restore connectable if slot */ in eds_slot_restart()
436 err = bt_le_adv_start(BT_LE_ADV_NCONN_IDENTITY, slot->ad, in eds_slot_restart()
437 ARRAY_SIZE(slot->ad), NULL, 0); in eds_slot_restart()
448 slot->type = type; in eds_slot_restart()
458 struct eds_slot *slot = &eds_slots[eds_active_slot]; in write_adv_data() local
461 if (slot->state == EDS_LOCKED) { in write_adv_data()
469 /* Writing an empty array, clears the slot and stops Tx. */ in write_adv_data()
471 eds_slot_restart(slot, EDS_TYPE_NONE); in write_adv_data()
491 slot->ad[2].data_len = MIN(slot->ad[2].data_len, in write_adv_data()
493 memcpy((uint8_t *) slot->ad[2].data + EDS_URL_WRITE_OFFSET, buf, in write_adv_data()
494 slot->ad[2].data_len - EDS_URL_WRITE_OFFSET); in write_adv_data()
496 /* Restart slot */ in write_adv_data()
497 if (eds_slot_restart(slot, type) < 0) { in write_adv_data()
538 struct eds_slot *slot = &eds_slots[eds_active_slot]; in write_connectable() local
540 if (slot->state == EDS_LOCKED) { in write_connectable()
548 if (len > sizeof(slot->connectable)) { in write_connectable()
555 memcpy(&slot->connectable, buf, len); in write_connectable()
566 /* Active slot: Must be unlocked for both read and write. */
606 /* ADV Slot Data: Must be unlocked for both read and write. */
640 /* Restore connectable if slot */ in bt_ready()
670 struct eds_slot *slot = &eds_slots[eds_active_slot]; in disconnected() local
674 if (!slot->connectable) { in disconnected()