Merge pull request #8483 from paul-szczepanek-arm/eeprom-fix

BLE: write size first when writing an eeprom message
pull/8503/head
Cruz Monrreal 2018-10-22 19:03:41 -05:00 committed by GitHub
commit ecb6e6effb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 10 deletions

View File

@ -126,8 +126,8 @@ private:
nfc_eeprom_idle,
nfc_eeprom_write_start_session,
nfc_eeprom_write_write_bytes,
nfc_eeprom_write_write_size,
nfc_eeprom_write_write_bytes,
nfc_eeprom_write_end_session,
nfc_eeprom_read_start_session,

View File

@ -138,8 +138,8 @@ void NFCEEPROM::on_session_started(bool success)
handle_error(NFC_ERR_CONTROLLER); // An EEPROM is not really a controller but close enough
return;
}
_current_op = nfc_eeprom_write_write_bytes;
continue_write();
_current_op = nfc_eeprom_write_write_size;
_driver->write_size(ac_buffer_reader_readable(&_ndef_buffer_reader));
break;
case nfc_eeprom_read_start_session:
@ -272,10 +272,8 @@ void NFCEEPROM::on_size_written(bool success)
return;
}
// End session
_current_op = nfc_eeprom_write_end_session;
_operation_result = NFC_OK;
_driver->end_session();
_current_op = nfc_eeprom_write_write_bytes;
continue_write();
break;
case nfc_eeprom_erase_write_max_size:
if (!success) {
@ -371,9 +369,10 @@ void NFCEEPROM::continue_write()
// Continue writing
_driver->write_bytes(_eeprom_address, ac_buffer_reader_current_buffer_pointer(&_ndef_buffer_reader), ac_buffer_reader_current_buffer_length(&_ndef_buffer_reader));
} else {
// Now update size
_current_op = nfc_eeprom_write_write_size;
_driver->write_size(_eeprom_address);
// we are done
_current_op = nfc_eeprom_write_end_session;
_operation_result = NFC_OK;
_driver->end_session();
}
}